UISplitViewController 代理方法

来源:互联网 发布:苹果mac版cad看图软件 编辑:程序博客网 时间:2024/06/15 22:01

 

 

@protocol UISplitViewControllerDelegate

 

@optional

1、

// Called when a button should be added to a toolbar for a hidden view controller.

// Implementing this method allows the hidden view controller to be presented via a swipe gesture if 'presentsWithGesture' is 'YES' (the default).

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

代理4返回YES时走此方法,一般实现横屏到竖屏动作:

  barButtonItem.title = NSLocalizedString(@"Presidents", @"Presidents");

    [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];

    self.masterPopoverController = popoverController;

 

2、

// Called when the view is shown again in the split view, invalidating the button and popover controller.

- (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem;

1代理走后又要出现左边导航时调用,一般实现:

[self.navigationItemsetLeftBarButtonItem:nilanimated:YES];

    self.masterPopoverController = nil;

 

3、

// Called when the view controller is shown in a popover so the delegate can take action like hiding other popovers.

- (void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController;

这发生在portrait模式下,用户单击屏幕上方的按钮弹出导航UIPopoverController信息时走此方法。

 

4、

// Returns YES if a view controller should be hidden by the split view controller in a given orientation.

// (This method is only called on the leftmost view controller and only discriminates portrait from landscape.)

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation NS_AVAILABLE_IOS(5_0);

一般不实现

 

@end