Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch screen is black when set to a storyboard file

I am using a storyboard to get the correct height of a navigation bar in my launch image.

However, after customizing the view controller a bit, it now displays a black screen instead of a launch image.

When I set it to a brand new view controller, everything is fine. It seems like the original view controller is now in a bad state.

How can I fix this?

(I'm running iOS 8.2 simulator on Xcode 6.2.)

like image 214
Senseful Avatar asked Apr 02 '15 18:04

Senseful


1 Answers

The problem in this case was that there was an outlet set on the view controller.

If there are any outlets on the initial view controller (or, if the initial view controller is a navigation controller, the root view controller), the system will not render any launch image, and instead show a black screen.

In my case I have my target's Main Interface set to the same value as the Launch Screen File (both set to storyboards). Once it launches the real app, I want to manipulate the view a bit (hence why I had an IBOutlet). After deleting the IBOutlets, I was able to manipulate the view by using -[UIView viewWithTag:].

Note: When the view controller is being used to render an image for the launch screen, none of the code in the class is called (e.g. -[UIViewController viewDidLoad] is never called). On the other hand, when the view controller is being used for the Main Interface, the code is executed normally, as you would expect.

like image 138
Senseful Avatar answered Oct 11 '22 14:10

Senseful