UISplitViewController
有委托方法:
-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController
我希望从类似但不存在的委托方法中获取功能:
-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willDismissViewController:(UIViewController *)aViewController
UISplitViewController
考虑到//通常考虑到这样做的最佳方法的想法不符合 KVO UIPopoverController
,UIKit
因此我无法向UIPopoverController
' 的isPopoverVisible
属性添加观察者。
谢谢
回答:
//Sent when switching to portrait
- (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc
{
...
self.popoverController = pc;
[self.popoverController setDelegate:self];
}
-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController
{
NSLog(@"SHOWING POPOVER");
}
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
{
NSLog(@"HIDING POPOVER");
}