chandresh_cool
chandresh_cool

Reputation: 11830

Question regarding Tab bar controller

I am using [self.view addSubView:tabBarController.view];

But because of this viewDidAppear and viewWillAppear is not getting called so if I want to reset my view or update the contents of it, its not happening. Can u help me?

Upvotes: 1

Views: 125

Answers (2)

chandresh_cool
chandresh_cool

Reputation: 11830

HI After some googling I have found the solution for the question. If you are using tabbar controller....then u can use :-

(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

method for invoking any function from other viewControllers.

Just you have to give

[viewController functionname];

that's it. Hope this post might help someone.

Upvotes: 1

Andriy
Andriy

Reputation: 2796

If you're linking against iOS 4.x SDK and lower, you should avoid using nested UIViewControllers.

But if it is really necessary, you should manually call viewWillAppear: (and all others) and make sure parentViewController property of your child view controller is referenced to UIViewController subclass that owns it.

P.S. If you'd like to add UITabBarController to fill all window contents, you can present it as modal view controller over another view controller or use rootViewController property of UIWindow class

Upvotes: 0

Related Questions