UIViewController Title attribute in Storyboard

后端 未结 10 2129
南旧
南旧 2021-02-03 19:58

I am setting the title field of a UIViewController via Interface Builder/Storyboard: \"enter

10条回答
  •  抹茶落季
    2021-02-03 20:25

    I tried all of the above methods, even tried manually adding a navigation bar but to no avail.

    So this is what worked for me.

    Remove any navigation bar item you manually added to the view controller and add this to your viewDidLoad method

    self.navigationController.navigationBar.topItem.title = @"My Title";
    

    or

    self.navigationController.topViewController.title = @"My Title";
    

提交回复
热议问题