objective c - Hiding the master view controller with UISplitViewController in iOS8 -
i have ios7 application, based on xcode master-detail template, porting ios8. 1 area has changed lot uisplitviewcontroller
.
when in portrait mode, if user taps on detail view controller, master view controller dismissed:
i able programmatically hide master view controller if user taps on row.
in ios 7, master view controller displayed pop-over, , hidden follows:
[self.masterpopovercontroller dismisspopoveranimated:yes];
with ios 8, master no longer popover, above technique not work.
i've tried dismiss master view controller:
self.dismissviewcontrolleranimated(true, completion: nil)
or tell split view controller display details view controller:
self.splitviewcontroller?.showdetailviewcontroller(bookviewcontroller!, sender: self)
but nothing has worked far. ideas?
extend uisplitviewcontroller follows:
extension uisplitviewcontroller { func togglemasterview() { let barbuttonitem = self.displaymodebuttonitem() uiapplication.sharedapplication().sendaction(barbuttonitem.action, to: barbuttonitem.target, from: nil, forevent: nil) } }
in didselectrowatindexpath
or prepareforsegue
, following:
self.splitviewcontroller?.togglemasterview()
this smoothly slide master view out of way.
i got idea of using displaymodebuttonitem() this post , simulating tap on per this post.
i not happy solution, since seems hack. works , there seems no alternative yet.
Comments
Post a Comment