【发布时间】:2011-12-19 10:46:56
【问题描述】:
我有一个 UIViewController 的问题,请在回答之前先阅读,它比看起来更复杂。无需更改超级 UIViewController 旋转即可正常工作!
我有一个纵向的 UISplitViewController,而不是我点击按钮来显示 UIPopoverController 现在我将 UIViewController 从 UISplitViewC 更改为 UITableViewC 现在我将 iPad 旋转到横向 最后切换回 SpliViewController! 如您所见,MasterViewController 没有显示,NavigationItem 也没有消失。
这让我假设在 UITableViewController 的旋转时不会调用 splitview 的委托函数(不足为奇)
我该如何处理这个问题?
委托功能
- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
//debug_NSLog(@"Entering portrait, showing the button: %@", [aViewController class]);
barButtonItem.title = @"Akten";
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
[self setMasterPopover: pc];
}
// 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 {
//debug_NSLog(@"Entering landscape, hiding the button: %@", [aViewController class]);
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
[self setMasterPopover: nil];
}
感谢您的帮助!
【问题讨论】:
-
这里有同样的问题。如果你解决了,你能发布你是怎么做的吗?谢谢
标签: ios ipad uisplitviewcontroller uipopovercontroller