nmn*_*mnm 10 iphone objective-c ios4
在IOS4.3中,如果我设置
navigationBar.tintColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1];
Run Code Online (Sandbox Code Playgroud)
我会得到内存泄漏:UIDeviceRGBColor泄漏
但如果我使用navigationBar.tintColor = [UIColor blackColor];
一切都很好.
这在ios4.2中从未发生过
我做了一些调试,[navigationBar.tintColor retainCount]如果我使用,我发现它看起来更大
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1];
Run Code Online (Sandbox Code Playgroud)
有没有人有同样的问题?
这是泄漏代码:
在RootViewController中:
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
[super viewWillAppear:animated];
}
Run Code Online (Sandbox Code Playgroud)
在DetailViewController中:
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.9 green:0 blue:0 alpha:0];
[super viewWillAppear:animated];
}
Run Code Online (Sandbox Code Playgroud)
如果你去DetailViewController,然后回弹到RootViewController,在Instruments中你可以看到UIDeviceRGBColor泄漏
| 归档时间: |
|
| 查看次数: |
3578 次 |
| 最近记录: |