DEBUG时候发现调用show之后立即调用了release,提示窗口还在显示,按钮还能响应,怎么回事呢?
show竟然不是堵塞的!!!什么原理UIAlertView *promptWindow = [[UIAlertView alloc]initWithTitle:
@"XXX。"
message:nil
delegate:self
cancelButtonTitle:@"去设置"
otherButtonTitles:@"知道了",
nil];
promptWindow.restorationIdentifier = @"not_first_open";
[promptWindow show];
[promptWindow release];
show竟然不是堵塞的!!!什么原理UIAlertView *promptWindow = [[UIAlertView alloc]initWithTitle:
@"XXX。"
message:nil
delegate:self
cancelButtonTitle:@"去设置"
otherButtonTitles:@"知道了",
nil];
promptWindow.restorationIdentifier = @"not_first_open";
[promptWindow show];
[promptWindow release];
我DEBUG代码,发现promptWindow已经执行了release操作,但是弹出的窗口依然存在,为什么不会出错? 我没有调用retain啊,难道系统内部自动调用了retain?
另外,数组的addObject也会使对象的引用计数+1。通常所说的,retain release是指显示的调用,其实在系统内部机制中,有许多需要注意的地方。
这些只有慢慢在开发中理解,并就用自如。