KVISH
KVISH

Reputation: 13178

iOS 10 navigiation bar tab bar issues

I have the following setup:

UINavigationController > TabBarController -> ViewController

This is using Swift3 and xcode 8.

when I do self.title it doesn't work. I'm not able to do it any other way, tried the below:

    self.tabBarController!.navigationItem.title = "test"
    self.tabBarController!.navigationController?.title = "test"
    self.tabBarController!.navigationController?.topViewController?.title = "test"

What am I doing wrong??

Upvotes: 2

Views: 182

Answers (2)

KVISH
KVISH

Reputation: 13178

answer was:

self.tabBarController!.navigationController!.navigationBar.topItem!.title = "Profile"

Upvotes: 1

Dan Levy
Dan Levy

Reputation: 4281

I think you'd be better off if your setup went:

TabBarController -> UINavigationController -> ViewController

and then just coding:

self.navigationItem.title = "test"
self.navigationController?.title = "test"
self.navigationController!.navigationBar.topItem!.title = "test"
self.navigationController?.topViewController?.title = "test"

Upvotes: 0

Related Questions