Hiding the master view controller with UISplitViewController in iOS8

后端 未结 10 972
囚心锁ツ
囚心锁ツ 2020-12-12 19:06

I have an iOS7 application, which was based on the Xcode master-detail template, that I am porting to iOS8. One area that has changed a lot is the UISplitViewControlle

10条回答
  •  暖寄归人
    2020-12-12 19:29

    Use preferredDisplayMode. In didSelectRowAtIndexPath or prepareForSegue:

    self.splitViewController?.preferredDisplayMode = .PrimaryHidden
    self.splitViewController?.preferredDisplayMode = .Automatic
    

    Unfortunately the master view abruptly disappears instead of sliding away, despite the documentation stating:

    If changing the value of this property leads to an actual change in the current display mode, the split view controller animates the resulting change.

    Hopefully there is a better way to do this that actually animates the change.

提交回复
热议问题