chenzhongpu
chenzhongpu

Reputation: 6871

which method be called-back when switching between tab bar view?

My initial question is:

enter image description here

I want to change the navigation item (both title and button when switching between tabs).

I tried the answer : Storyboard navigation controller and tab bar controller. It says:

self.parentViewController.navigationItem setTitle:@"Title"];

add to viewDidLoad in each view controller works.

However, when I re-enter the view, the tile won't change. I think it means viewDidLoad won't get called-back when re-entering.

Any solution about Storyboard navigation controller and tab bar controller ?

Upvotes: 0

Views: 891

Answers (2)

Senõr Ganso
Senõr Ganso

Reputation: 1734

It would be better to have a navigation controller for each tab in you tab bar. Then you can set your titles right in the storyboard.

Upvotes: 0

Morgan Chen
Morgan Chen

Reputation: 1217

You're looking for viewWillAppear:. Here's Apple's documentation. This method will be called on the controller that is being presented, or being transitioned to. viewWillDisappear: (documentation here) is called on the controller that is being transitioned away from.

Upvotes: 2

Related Questions