Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't a UISplitViewController be the rootViewController property of a UIWindow?

When creating the initial view in iPhone applications you can set the IBOutlet rootViewController property of the main UIWindow to your default view controller, but this doesn't work with a UISplitViewController.

If I do this I don't receive any compile errors, and the app runs, but no screen is displayed on app startup.

The way recommended by the Apple docs for UISplitViewController is to do the following within your app delegate launch method:

[window addSubview:splitViewController.view];

I was just wondering why UISplitViewController needed this different approach.

like image 943
donturner Avatar asked Dec 03 '25 16:12

donturner


1 Answers

Of course that works. In fact, it's what the Split View-based Application template from Xcode 4.0.2 does (SDK 4.3).

Split view controllers are only intended for iPad, not iPhone, though. Are you trying this on an iPhone project?

Update

Since iOS 8 it is available on all devices.

like image 80
Hollance Avatar answered Dec 05 '25 07:12

Hollance



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!