How can I dismiss the master view from a UISplitViewController in iOS 5.1

可紊 提交于 2019-12-11 03:24:19

问题


I am trying to hide the master view controller when a selection has been made in the table view. I've looked all over stackoverflow and can only find solutions that used to work prior to iOS 5.1

I've tried to dismissPopoverAnimated or dismissModalViewControllerAnimated, but none of those seem to work.

There has got to be a way to hide the masterview controller once a section has been made.

Any help would be really appreciated. Thanks.


回答1:


you have to dismiss your popovercontroller. see this answer, there is a code example:
https://stackoverflow.com/a/5829368/558150




回答2:


Actually I figured it out after a lot of playing around What I did was save 'pc' in a

UIPopoverController * popOver in: - (void) splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc; 

then used:

[[[self.splitViewController.viewControllers lastObject] popOver] dismissPopoverAnimated:YES]; 

There might be a better way to do this, but it works as expected




回答3:


The IOS 6.0 SplitView template makes this easy, simply set the detailItem and the popover disappears if appropriate. There is even a check if you are using the same detaiItem so no page setup and refresh work gets done.

self.detailViewController.detailItem = self.detailViewController.detailItem;


来源:https://stackoverflow.com/questions/11422812/how-can-i-dismiss-the-master-view-from-a-uisplitviewcontroller-in-ios-5-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!