Reputation: 81
I'm just starting an iphone app with a initial viewcontroller
which is embeded in a navigationController
and have a pushSegue
to a tabBarController
.
Whenever I run the simulator, viewDidAppear of the initial viewController
called before applicationDidBecomeActive
being called.
Isn't it suppose to enter applicationDidBecomeActive
in appdelegate
before any viewController
load?
Upvotes: 3
Views: 1571
Reputation: 38162
applicationDidBecomeActive
is a delegate located in your Application Delegate and there's no guarantee that it will be called before any other UIViewController delegates (viewWillAppear, viewDidLoad etc.). If you want to make any logic before loading of any other view controller method is called, you may want to use application:didFinishLaunchingWithOptions:
.
Upvotes: 1
Reputation: 2235
In iOS8, viewDidLoad used to run before applicationDidBecomeActive. However, in iOS9, I'm seeing that with the same code, applicationDidBecomeActive is running before viewDidLoad. Strange.
Upvotes: 2
Reputation: 7207
Yes it's ok I think you are just little confuse. How an application will become active until it's load it's view.
When you first time launch the application will call the method in order -
From App Delegate -
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
From View Controller -
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)viewDidLoad
- (void)viewWillAppear:(BOOL)animated
- (void)viewDidAppear:(BOOL)animated
From App Delegate -
- (void)applicationDidBecomeActive:(UIApplication *)application
Upvotes: 1