In many code samples, also on the Apple documentation website, you will see such a pattern. UIAlertView is called with the sequences "show" and "release".
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Panic!"
message:@"The world is gonna explode!"
delegate:nil cancelButtonTitle:@"Who cares?"
otherButtonTitles:@"Boom!", nil];
[alert show];
[alert release];
NSLog(@"released!");
When you run this code, "released!" the log line will be displayed while the UIAlertView field is still displayed on the screen. It seems to me a strange pattern to release this object when it is still visible on the screen. What is the idea of this, isn't it against what is common with memory management? If this call to “show” is blocked, I could see how this template will free memory safely. But since the NSLog method is executing, it continues to execute your code.
source
share