【发布时间】:2011-09-10 17:04:22
【问题描述】:
我使用这个代码。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
view = [[UIView alloc] init];
[_window addSubview:view];
[view release];
NSLog(@"count - %d", [view retainCount]);
[self.window makeKeyAndVisible];
return YES;
}
- (IBAction)click{
NSLog(@"count - %d", [view retainCount]);
}
当我点击 uibutton 时 - 我的视图保留计数 = 2。 为什么会这样?
【问题讨论】:
-
你有没有试过先
removeFromSuperView然后打电话release?
标签: ios memory-management retaincount