UISplitViewController primaryBackgroundStyle = .sidebar on regular UIViewController

I have a UISplitViewController where the master is a regular UIViewController (not a UITableViewController).


I setted the primaryBackgroundStyle to .sidebar on the split view controller subclass, but it doesn't seems to affect the view controller's background at all. I do have a custom background color on the UIViewController set for the iOS version, but setting it to clear doesn't help, just makes the background looks really wierd.


Any idea on whether this is not supported at all or it's just a bug in the beta?


All the demos I'ves seen are with a table view on the left, not a regular view controller.

Accepted Reply

> master is a regular UIViewController


About that, and not sure if it's your problem, but just so you know, there is a heirarchy that applies, which may be why you don't see the effect you expect.


Docs:

"A split view controller must always be the root of any interface you create. In other words, you must always install the view from a

UISplitViewController
object as the root view of your application’s window. The panes of your split view interface may then contain navigation controllers, tab bar controllers, or any other type of view controller you need to implement your interface. Split view controllers cannot be presented modally."


That said, this on combined vc is from the docs on 'Order of Containment': https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html


-=-

Combined View Controller Interfaces

You can use the view controllers that the UIKit framework provides by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. When combining view controllers, however, the order of containment is important; only certain arrangements are valid. The order of containment, from child to parent, is as follows:

  • Content view controllers, and container view controllers that have flexible bounds (such as the page view controller)
  • Navigation view controller
  • Tab bar controller
  • Split view controller

-=-

Replies

> master is a regular UIViewController


About that, and not sure if it's your problem, but just so you know, there is a heirarchy that applies, which may be why you don't see the effect you expect.


Docs:

"A split view controller must always be the root of any interface you create. In other words, you must always install the view from a

UISplitViewController
object as the root view of your application’s window. The panes of your split view interface may then contain navigation controllers, tab bar controllers, or any other type of view controller you need to implement your interface. Split view controllers cannot be presented modally."


That said, this on combined vc is from the docs on 'Order of Containment': https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html


-=-

Combined View Controller Interfaces

You can use the view controllers that the UIKit framework provides by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. When combining view controllers, however, the order of containment is important; only certain arrangements are valid. The order of containment, from child to parent, is as follows:

  • Content view controllers, and container view controllers that have flexible bounds (such as the page view controller)
  • Navigation view controller
  • Tab bar controller
  • Split view controller

-=-