Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITabBarController inside a UIViewController = viewDidAppear: not called

I start off with a login screen. Then after the user logs in I load a Viewcontroller with UITabBArController in it. The problem is viewdidAppear: does not get called for any of the individual viewControllers in the tabBarController.

I have a feeling that this is not the best programming practise so does anyone have any ideas how to improve the structure of my code or how to fix my problem ?

like image 779
James Avatar asked Jul 24 '26 22:07

James


2 Answers

I'd guess your trouble here comes from incorrect use of UIViewController and UITabBarController.

UITabBarController exists as a container for multiple view controllers. It probably should not, itself, be contained. It's designed to sit at the top of a view controller hierarchy. So step one is probably to re-arrange your application so that the UITabBarController is no longer under anything else and see if that straightens you out.

After that, slev's approach of presenting the login view sounds like the right one.

like image 183
Danilo Campos Avatar answered Jul 26 '26 12:07

Danilo Campos


I had a problem because I was subclassing also UITabBarControler where I have overridden viewDidAppear without calling [super viewDidAppear:...]

After calling this, viewDidAppear was called also inside sub-view-controller.

like image 34
Matej Ukmar Avatar answered Jul 26 '26 13:07

Matej Ukmar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!