self.title sets navigationController and tabBarItem's title? Why?

后端 未结 4 1562
孤城傲影
孤城傲影 2020-11-30 19:15

I do this in a UIViewController for one of my tabs:

self.title = @\"Welcome\";

However, it\'s overwriting whatever I have for the tabBarIte

4条回答
  •  北海茫月
    2020-11-30 19:36

    OK, I figured it out! Here's what I am doing:

    self.title = @"Title for TabBarItem"; // TabBarItem.title inherits the viewController's self.title
    self.navigationItem.title = @"Title for NavigationBar";
    

    the navigationBar would inherit self.title, unless otherwise set using self.navigationItem.title

提交回复
热议问题