Do not confuse auto-advertisement in this line:
self.popOver = [[[UIPopoverController alloc] initWithContentViewController:popOverContent] autorelease];
After this statement, you actually own the object , because the setter property claimed ownership of it. Car ads balance alloc-init .
So ... yes, you need auto-advertisement when posting. If you did this (without auto advertising), you would have missed:
self.popOver = [[UIPopoverController alloc] initWithContentViewController:popOverContent];
Another option is to use a temporary variable instead of autorelease :
UIPopoverController *temp = [[UIPopoverController alloc] initWithContentViewController:popOverContent]; self.popOver = temp; [temp release];
In any case, you need to free the object in dealloc .
albertamg
source share