我在我的应用程序 WEPopoverController 中显示一个弹出窗口,
它在用户点击按钮后出现和消失,
它有时可以正常工作,但有时它会崩溃,比如如果我打开 i 并关闭它很多次它会崩溃,所以我不知道我在这个对象的内存管理中缺少什么,
- (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");
}
}
多谢,