在下面的代码中,alert
被分配和初始化,显示,然后释放。释放前后,alert
仍然指向同一个地址。为什么系统没有将alert
指针设置为nil
after release
?:
-(void) viewDidLoad {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @”Hello”
message: @”This is an alert view”
delegate: self
cancelButtonTitle: @”OK”
otherButtonTitles: @”Option 1”, @”Option 2”, nil];
[alert show];
[alert release];
[super viewDidLoad];
}