简体   繁体   English

iPhone-切换视图时黑屏

[英]iPhone - Blank Screen when Switching VIews

I have an application that makes use of drill-down views, tabbars, etc. I'm also making use of the UIImagePicker, as well as Route-Me for mapping support. 我有一个使用向下钻取视图,标签栏等的应用程序。我还利用了UIImagePicker以及Route-Me的映射支持。 Normally, the application performs fine. 通常,该应用程序运行良好。 However, I find that if I perform a lot of activities and then switch between views, I end up with a blank screen and my view is not drawn. 但是,我发现如果我执行很多活动然后在视图之间切换,则最终会出现空白屏幕,并且不会绘制视图。 My hunch is this is memory related, but how can I be sure? 我的直觉是这与内存有关,但是我如何确定? Has anyone encountered a similar situation? 有没有人遇到过类似的情况? How did you go about correcting it? 您如何去纠正它? What can I look for? 我能找什么? Thanks for any help you can give! 谢谢你提供的所有帮助!

Steve 史蒂夫

You're view is probably being unloaded in the background. 您可能正在后台卸载视图。 If you have access to forums, here is a good thread: https://devforums.apple.com/message/56191 如果您有权访问论坛,那么这里是一个很好的话题: https : //devforums.apple.com/message/56191

Basically, you need to expect that while in another part of the application, iphone may unload a view which isn't active (see viewDidUnload method). 基本上,您需要期望在应用程序的另一部分中,iphone可能会卸载未激活的视图(请参见viewDidUnload方法)。 When you switch to that view, it will then call viewDidLoad again. 当您切换到该视图时,它将再次调用viewDidLoad。

I had this exact problem... In the method that handles my UIView switching, I checked for ([newViewController.view superview] == nil) which it was during a blank-out! 我有这个确切的问题...在处理我的UIView切换的方法中,我检查了[[newViewController.view superview] == nil)是在空白期间! So I went and re-initted it using [[NewViewController alloc] initWithNibName:@"NewView" bundle:nil] 因此,我使用[[NewViewController alloc] initWithNibName:@“ NewView” bundle:nil]重新初始化了它

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM