我有一個包含五個splitviewcontrollers的選項卡式應用程序。SplitViewController在縱向視圖中崩潰(ipad)
在縱向模式下,「主」按鈕按預期顯示,並且在前兩個控制器上該按鈕的行爲如預期。然而上最後三個標籤,按鈕會導致以下消息崩潰:
斷言失敗 - [_ UISlidingPopoverLayoutInfo _popoverViewSizeForContentSize:arrowDirection:],/SourceCache/UIKit_Sim/UIKit-1914.84/_UIPopoverLayoutInfo.m:160 2012- 04-24 19:15:38.674 SMToolkit [12420:11303] *終止應用程序由於未捕獲的異常 'NSInternalInconsistencyException',原因: '傳遞給_popoverViewSizeForContentSize未知方向:arrowDirection:'
事情是,五個視圖是從相同的來源剪切粘貼,幾乎是蘋果的樣板。我不是真正的故事板popovers,我也不讓他們在prepareforsegue方法,因爲spliltviewcontroller理論上給了他們我的「自由」
所有五個splitviewcontrollers符合UISplitViewControllerDelegate
的appdelgate是像這樣:
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
//Person
UISplitViewController *personSplitViewController = [tabBarController.viewControllers objectAtIndex:1];
UINavigationController *personNavigationController = [personSplitViewController.viewControllers lastObject];
personSplitViewController.delegate = (id)personNavigationController.topViewController;
UINavigationController *personMasterNavigationController = [personSplitViewController.viewControllers objectAtIndex:0];
PersonMasterViewController *personController = (PersonMasterViewController *)personMasterNavigationController.topViewController;
personController.managedObjectContext = self.managedObjectContext;
//Scene
UISplitViewController *sceneSplitViewController = [tabBarController.viewControllers objectAtIndex:2];
UINavigationController *sceneNavigationController = [sceneSplitViewController.viewControllers lastObject];
sceneSplitViewController.delegate = (id)sceneNavigationController.topViewController;
UINavigationController *sceneMasterNavigationController = [sceneSplitViewController.viewControllers objectAtIndex:0];
SceneMasterViewController *sceneController = (SceneMasterViewController *)sceneMasterNavigationController.topViewController;
sceneController.managedObjectContext = self.managedObjectContext;
等,在詳細視圖中的控制器然後代在tabBarController
正確的索引,每一個具有以下的(相同的,我檢查):
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
barButtonItem.title = NSLocalizedString(@"Master", @"Master");
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
self.masterPopoverController = popoverController;
}
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
// Called when the view is shown again in the split view, invalidating the button and popover controller.
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
self.masterPopoverController = nil;
}
在上面,'人'的行爲如預期,但'場景'導致崩潰。
我沒有看到任何視圖中的任何地方,談論點擊barbuttonitem時會發生什麼,並且它不會出現在故事板中。
想法?
你有沒有想過如何使這項工作?如果是這樣,怎麼樣?我有完全一樣的錯誤。 – 2012-05-23 00:21:19