iphone viewWillAppear not firing
来源:互联网 发布:linux 查看用户状态 编辑:程序博客网 时间:2024/04/29 13:29
I've read numerous posts about people having problems with viewWillAppear when you do not create your view heirarchy JUST right. My problem is I can't figure out what that means.
If I create a RootViewController and call addSubView on that controller, I would expect the added view(s) to be wired up for viewWillAppear events.
Does anyone have an example of a complex programmatic view heirarchy that successfully recieves viewWillAppear events at every level?
Apple Docs state:
Warning: If the view belonging to a view controller is added to a view hierarchy directly, the view controller will not receive this message. If you insert or add a view to the view hierarchy, and it has a view controller, you should send the associated view controller this message directly. Failing to send the view controller this message will prevent any associated animation from being displayed.
The problem is that they don't describe how to do this. What the hell does "directly" mean. How do you "indirectly" add a view.
I am fairly new to Cocoa and iPhone so it would be nice if there were useful examples from Apple besides the basic Hello World crap.
Any help is greatly appreciated...
answers:
(1)f you use a navigation controller and set its delegate, then the view{Will,Did}{Appear,Disappear} methods are not invoked.
You need to use the navigation controller delegate methods instead:
navigationController:willShowViewController:animated
:
navigationController:didShowViewController:animated:
(2)
I've run into this same problem. Just send a viewWillAppear message to your view controller before you add it as a subview. (There is one BOOL parameter which tellsthe view controller if it's being animated to appear or not.)
[myViewController viewWillAppear:NO];
Look at RootViewController.m in the Metronome example.
(I actually found Apple's
转:
http://blog.csdn.net/koupoo/article/details/6528463
- iphone viewWillAppear not firing
- iphone viewWillAppear not firing
- viewWillAppear, viewDidAppear not being called, not firing
- iphone viewWillAppear
- not firing itemclick event
- ViewDidAppear/ViewWillAppear not being called
- RadioButton not firing OnCheckedChanged in ajax
- iphone开发之解决viewWillAppear失效
- iphone开发之解决viewWillAppear失效
- iphone上有时候viewWillAppear不被调用
- iphone开发之解决viewWillAppear失效
- iphone开发之解决viewWillAppear失效
- iphone开发之解决viewWillAppear失效
- iphone开发之解决viewWillAppear失效
- iphone开发之解决viewWillAppear失效
- viewWillAppear
- Viewwillappear
- viewDidAppear/viewWillAppear in UINavigationController not be called
- UITableView探索
- Weblogic下部署服务遭遇各种问题的解决方案
- AsyncTask类的使用
- struts 实现文件上传与下载
- Inside The C++ Object Model(Note):sizeof in an object
- iphone viewWillAppear not firing
- 忘记了以su模式进入vim编辑器
- 上班第一件事
- 数据结构课程设计总结--学生作业管理系统
- java future模式
- Dom4j的使用
- 轻松通过系分论文考试
- SSH整合中 hibernate托管给Spring得到SessionFactory
- 工作以后十不要 减少奋斗30年