iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar(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.
这就是我正在做的事情.在视图控制器中,当按下某个按钮时,我会调用以下命令:
Here is what I am doing. From a view controller, I call the following when a certain button is pushed:
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 中按下某个按钮,我调用:
Then, if a certain button is pushed in EventsController, I call:
SingleEventViewController *viewController = [[SingleEventViewController alloc] initWithEvent:[currentEvents objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
然后,如果在 SingleEventViewController 中按下某个按钮,我调用:
Then, if a certain button is pushed in SingleEventViewController, I call:
EventMapView* viewController = [[EventMapView alloc] initWithCoordinates];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];
是的,很明显有嵌套的推送动画,但这不是正确的做法吗?我查看了 Apple 的 DrillDownSave 代码,这似乎是他们的做法.我使用 init 方法而不是 viewDidLoad 方法是否重要?
So yea, it's obvious that there's nested push animations, but isn't this the right way to go about it? I checked out Apple's DrillDownSave code and this appears to be how they're doing it. Does it matter that I use init methods instead of viewDidLoad methods?
推荐答案
我想通了.显然,如果您从 UITableViewDelegate 的 -didSelectRowAtIndexPath 方法之外调用 -pushViewController,它就不起作用.将调用移到该函数中有效.很奇怪.
I've figured it out. Apparently if you call -pushViewController from outside of the -didSelectRowAtIndexPath method of a UITableViewDelegate, it doesn't work. Moving the call into that function worked. Weird.
这篇关于iPhone UINavigation 问题 - 嵌套推送动画可能导致导航栏损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone UINavigation 问题 - 嵌套推送动画可能导致导航栏损坏
基础教程推荐
- EditText 中的 setHintTextColor() 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01