我有@property(nonatomic,retain) UIPopoverController * popoverController;
我在我的实现类中创建了我的弹出框。
我用这个:
- (void)createPopover:(NavigationController *)tempNavigation {
UIPopoverController *tempPopover = [[UIPopoverController alloc] initWithContentViewController:tempNavigation];
self.popoverController = tempPopover;
[self.popoverController setPopoverContentSize:CGSizeMake(width, height)];
tempPopover.delegate = self;
CGRect selectedRect = [self.tableView rectForRowAtIndexPath:indexPath];
[tempPopover presentPopoverFromRect:selectedRect inView:self.tableView permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[tempPopover release];
}
在这种方法中,我需要释放我的弹出框
我用这个:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (popoverController) {
[popoverController dismissPopoverAnimated:NO];
self.popoverController=nil;
[popoverController release];
}
return YES;
}
我的问题:在这种方法中释放 popover 的正确方法。或者我必须只在 dealloc 方法中释放 popover?