【发布时间】:2010-09-12 14:18:42
【问题描述】:
当我在基于导航的 iPhone 应用中收到内存警告时,背景图像会在之前分配的导航控制器中消失。
背景图片被设置为 UIView 的背景属性。然后将此视图添加到 App 委托的主窗口中:
UIView *backgroundView = [[UIView alloc] initWithFrame: window.frame];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[[Utilities sharedManager] getImageWithName:@"Hintergrund2"]]; 背景视图.tag = 56789; [窗口添加子视图:背景视图]; [背景视图发布];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
在我收到内存警告信息并按下导航控制器的返回按钮后,之前的导航控制器显示正常的 Apple 灰色背景。我必须导航回主屏幕并向前导航以“重置”背景图像。
谁能告诉我为什么背景消失了?这不是因为图像,当我将背景设置为像 blackColor 这样的标准 UIColor 时,背景(颜色)也会消失。
提前感谢您的帮助!
问候
菲尔
【问题讨论】:
标签: iphone objective-c memory-leaks