How to enable UISplitViewController's preferredDisplayMode = .primaryOverlay setting for iPhone size class - ios

I am trying to use the UISplitViewController for iPhone portrait mode (since it will use navigation controller instead).
I tried to set the UISplitViewController's preferredDisplayMode = .primaryOverlay (which let user to swipe in/out master view from the left). However, this setting only works for iPad and Plus. iPhone still keep using navigation controller, ignoring my setting.
My question is - how to use UISplitViewController for iPhone? I see that Outlook iOS app can do this so it should be possible.
Thanks.

The UISplitViewController only works on iPads. On iPhone it acts like a master/detail view controller. If you want that UI style for iPhone you'll have to implement it yourself.

Related

UISplitViewController - Use as slideout-style menu

I'm struggling a bit with the new UISplitViewController in iOS 8.
I want to achieve a slideout-style menu on iPhone (landscape and portrait) as well as on iPad in portrait orientation and a persistent sidebar on iPad in landscape orientation.
I got a UITableViewController as the master and a UINavigationController with a couple of UIViewControllers as the detail in my SplitViewController.
Is it possible to to get something like this with the new UISplitViewController in iOS 8?
First it would be enough the get the iphone sliding thing to run :D
Thank you :)
The UISplitViewController will do just that. Sliding menus and everything.
It works like a dream if you use it exactly by the book. And this requires setup of some UINavigationControllers as part of the magic.
Tutorial is highly recommended for the first time. It's easy to get it messed up quickly otherwise. :)
http://nshipster.com/uisplitviewcontroller/
By default, the UISplitViewController in iOS8 will only act as a slideout-style menu on the iPad (in both portrait and landscape mode) and iPhone 6+ (in landscape mode only).
As to whether or not it is possible to get the slideout-style menu working on all iphones via the splitViewController, I don't actually know (I'm still new to iOS development). I suspect that it entails modifying how the splitViewController treats different size classes. If there isn't an easy way to change the splitViewController's behavior, perhaps you could subclass the splitViewController and override the functionality that you do not like.
I have not tried this before, nor do I actually know how the controller determines how it is displayed in different size classes. However, if I were trying to accomplish what you are, then this is what I would be looking up.

How can I implement the new iPad-like landscape mode on iPhone 6 plus

Apple has introduced a new iPad-like split view in landscape mode for iPhone plus, which help users take advantage of their larger screen.
I have designed an universal iOS app which uses UISplitViewController to show detail and master view in iPad, and uses UINavigationViewController to show the TableView in iPhone.
Now that we have iPhone plus, how can I implement the new iPad-like landscape view while I am using UINavigationViewController as the main structure in iPhone.
You might want to take a look at the "Building Adaptive Apps with UIKit" video on https://developer.apple.com/videos/wwdc/2014/
De basic idea is that the split view controller is used on iPhone and iPad. But when it detects that the device has a "Compact" horizontal size class it pushes the detailview on top of the master view, whereas with a "Regular" size class it shows the detailview next to the master view.

To show master view alone in portrait mode

I am using a UISplitViewcontroller in my iPad app. My requirement is to show just the master view in portrait mode and both master and detail in landscape mode. I tried using a SplitView controller, but it only shows the detail view in portrait mode.
The delegate function splitViewController:shouldHideViewController:inOrientation: will show both master and detail in portrait, but that is not my requirement.
Also it is only supported from iOS 5.0 and my app should support iOS 4.3.
put
self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.allVisible
in your MasterViewController

Landscape-only IPad App With UISplitViewController

I am almost done developing an app. Right now I'm converting it to a universal app by supporting iPad to supported devices as well.
Can I set the app to use Landscape orientation only, since I am using UISplitViewController and want the Master View Controller to remain on the screen all the time? Is there any Apple policy that states that I cannot restrict it to Landscape only and I have to implement both portrait and landscape? Is there any chance my app can be rejected by setting it to Landscape only for iPad?
Don't worry, you'll be fine. Support both landscape orientations and neither portrait orientation if you want. I've got apps in the store that are like that.
However, note that UISplitViewController does have an option to keep both views on the screen all the time even in portrait. Use the delegate method splitViewController:shouldHideViewController:inOrientation: to forbid hiding the master view:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intf/UISplitViewControllerDelegate
So if your only reason for being landscape only is that you don't want to hide the master view, it is a false reason. Look, for example, at Apple's Settings app, which works like that; it is a split view controller that always shows both views in all four orientations.

iPad tab bar application needs to support both portrait orientations

Is there an easy way to set my application so that it can automatically rotate to only the portrait modes (no landscape)?
Found the answer - I had not set the autorotation delegate in all of my view controllers

Resources