I am using the Master of a Master detail project as a popover, however in one circumstance where I add a subview to the detail view I don't want the user to be able to slide out the masterview popover , is there anyway to hide or temporary disable the popover ?
Asked
Active
Viewed 747 times
1 Answers
0
you can check if your popover is visible and dismiss it when you recceive a notification that the popover will be shown:
- (void)splitViewController:(UISplitViewController*)svc
popoverController:(UIPopoverController*)pc
willPresentViewController:(UIViewController *)aViewController{
if ([pc isPopoverVisible]) {
[pc dismissPopoverAnimated:YES];
}
}
Starting iOS5 if you implement the splitViewController:shouldHideViewController:inOrientation method in your delegate controller (usually the detail view controller) you can prevent the master controller to be shown on a popover:
- (BOOL)splitViewController:(UISplitViewController *)svc
shouldHideViewController:(UIViewController *)vc
inOrientation:(UIInterfaceOrientation)orientation
{
return NO;
}
I believe the last solution is more what you are looking at.

tiguero
- 11,477
- 5
- 43
- 61
-
Hmm, the event fires fine but I can't seem to dismiss the popover, can you dismiss it on a willappear event ? the condition of isPopoverVisible never gets met. – cmhdev Aug 24 '12 at 18:10
-
no that's a bad idea. The splitviewcontroller is responsible to dismiss its childview controller. As i said the second solution might be more appropriate to u – tiguero Aug 24 '12 at 18:13
-
those get fired upon loading however it is only during a series of events after loading that I want to block the popup. I think you are getting me closer though – cmhdev Aug 24 '12 at 18:36
-
those methods are really your only two points of control for the display of the masterview controller in a popover. I don't see what kind of other events you would like to catch here. – tiguero Aug 24 '12 at 19:01
-
depending on a situation in my app I want to disable the popover, the events above let me know the view is about to appear but i can't seem to stop it from appearing. – cmhdev Aug 24 '12 at 19:06
-
did u check if [pc dismissPopoverAnimated:YES]; is called? – tiguero Aug 24 '12 at 19:24
-
yes it does run the [pc dismissPopoverAnimated:YES] but doesn't remove the popover – cmhdev Aug 24 '12 at 19:43
-
i think u need a better understanding of what u are doin at this point. Did u read this at least? http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewController_class/Reference/Reference.html#//apple_ref/doc/uid/TP40009277 – tiguero Aug 24 '12 at 20:13
-
i have play a bit with the default template. Actually the popover is never shown by default except if you click on the master button... – tiguero Aug 24 '12 at 20:17
-
this was able to solve my problem http://stackoverflow.com/questions/9628107/master-table-application – cmhdev Aug 28 '12 at 17:23
-
ok i didn't know u can slide the popover when in portrait mode. I just thought you need to press the top left button. – tiguero Aug 28 '12 at 20:14