Reputation: 272
I was wondering in all iOS applications we have to write makeKeyAndVisible for our UIWindow object. So is there a example where we dont want our application to makeKeyAndVisible.
If we always require it for any application, then why dint apple automatically write it for us, like they did for @synthesize as part of iOS 6?
Upvotes: 2
Views: 3845
Reputation: 131
If you use storyboard to launch your app it's not required to call makeKeyAndVisible.
You can try to create a new project in Xcode 6. The project is not using makeKeyAndVisible, and you will get nil if you try to get keyWindow.
Upvotes: 2
Reputation: 2775
Apple handles makeKeyAndVisible automatically with storyboards
With storyboards, iOS performs the following steps:
Upvotes: 11
Reputation: 318944
An app can have more than one window. The call to makeKeyAndVisible
is used to specify which one is current.
Despite the fact that most apps only have one window, there is no way to assume that your primary window is to be the key window. Therefore you must explicitly call makeKeyAndVisible
.
Upvotes: 10