我不斷收到以下錯誤:iPhone UINavigation問題 - 嵌套推動畫可以導致損壞的導航欄
2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
下面是我在做什麼。從一個視圖控制器,我請當某個按鈕被按下的情況如下:
EventsViewController *viewController = [[EventsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
navController.navigationBar.tintColor = [UIColor blackColor];
[self presentModalViewController:navController animated:YES];
[viewController release];
[navController release];
然後,如果某個按鈕被EventsController推動時,我稱:
SingleEventViewController *viewController = [[SingleEventViewController alloc] initWithEvent:[currentEvents objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
然後,如果某個按鈕在SingleEventViewController推,我呼籲:
EventMapView* viewController = [[EventMapView alloc] initWithCoordinates];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];
所以啊,很明顯,有嵌套推動畫,但是這不就是去了解它的正確方法?我檢查了Apple的DrillDownSave代碼,這似乎是他們如何做的。我使用init方法而不是viewDidLoad方法是否重要?
這可以解決問題,因爲只有在視圖完成動畫之後才能調用didSelectRowAtIndexPath。如果您只是確保在viewDidAppear:或更高版本中調用您的pushViewController,則iOS不會抱怨嵌套的pushViewController調用。 – 2011-05-30 02:58:09
我真的不明白「顯然,如果您從UITableViewDelegate的-didSelectRowAtIndexPath方法的外部調用-pushViewController,它不起作用。」它在我的項目中起作用。 – 2015-12-30 08:02:22