我想使每当用户从横向视图中的iPad UIsplitView纵向视图切换酥料饼的视图中可见。虽然用户可以使其可见通过单击栏按钮,但我想这对于肖像模式是自动的。

有帮助吗?

解决方案

内部“ - (BOOL)shouldAutorotateToInterfaceOrientation”的方法,支票orientation.If它是肖像的设备,然后存在于酥料饼您为使其可见做当用户点击栏按钮

所有最好的。

其他提示

UISplitViewController将消息发送到他的代表(UISplitViewControllerDelegate)。您可以实现此委托方法来显示酥料饼。你可以做这样的事情在你的“详细控制器”代码:

#pragma mark -
#pragma mark UISplitViewControllerDelegate implementation
- (void)splitViewController:(UISplitViewController*)svc 
     willHideViewController:(UIViewController *)aViewController 
          withBarButtonItem:(UIBarButtonItem*)barButtonItem 
       forPopoverController:(UIPopoverController*)pc
{  
    [barButtonItem setTitle:@"Your 'popover button' title"];
    self.navigationItem.leftBarButtonItem = barButtonItem;
}


- (void)splitViewController:(UISplitViewController*)svc 
     willShowViewController:(UIViewController *)aViewController 
  invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
    self.navigationItem.leftBarButtonItem = nil;
}

(使用shouldAutorotateToInterfaceOrientation)接受的答案并不为我工作。它或者在随后的旋转的旋转构件(在4.2和5.0的iPad模拟器)或在启动时只显示永不再(4.3模拟器)。我所做的却是创建一个小帮手功能:

- (void)showPopoverInPortrait {
    if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait) {
        [self.masterPopoverController presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem
                                             permittedArrowDirections:UIPopoverArrowDirectionAny 
                                                             animated:YES];
    }
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation- (void)viewDidLoad内调用此同时还处理在启动时。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top