i show a pop over in my app WEPopoverController,
it appears and dissapears after the user taps a button,
it works fine some times,
but other times it crashes, like if i open i and close it a lot of times it will crash, so I don’t know what im missing in the memory management of this object,
- (void)showPopOver
{
if(!self.navPopover) {
CGRect frame ;
frame = CGRectMake(0, 0, 270, 132);
UIViewController *viewCon = [[UIViewController alloc] init];
viewCon.contentSizeForViewInPopover = frame.size;
self.navPopover = [[WEPopoverController alloc] initWithContentViewController: viewCon];
[self.navPopover setDelegate:self];
}
if([self.navPopover isPopoverVisible]) {
[self.navPopover dismissPopoverAnimated:YES];
[self.navPopover setDelegate:nil];
//[self.navPopover autorelease];
self.navPopover = nil;
[self.navPopover release];
//[_navPopover release];
NSLog(@"sconda");
} else if (![self.navPopover isPopoverVisible]){
[self.navPopover presentPopoverFromRect:CGRectMake(134,440, 50, 96)
inView:self.view
permittedArrowDirections: UIPopoverArrowDirectionDown
animated:YES];
NSLog(@"tanga");
}
}
thanks a lot,
re: memory management, this is surely wrong:
by niling the pointer, you’re not releasing the object. Reverse the order of these lines of code