PDA

View Full Version : Show the Pop Over while previous Pop Over still visible cause apps crash?




cthesky
Feb 5, 2012, 10:44 PM
Hi all,

In my project, when I clicked a Bar Button, a pop over will be displayed, but when I clicked the Bar Button again while the previous pop over still visible, it cause the application crash. Below is my code that show the pop over when click on Bar Button:


-(IBAction) showPopOver:(id) sender
{
PopOverViewController *popOver = [[PopOverViewController alloc]
initWithNibName:@"PopOverViewController" bundle:[NSBundle
mainBundle]];

UIPopoverController * myPopOver = [[UIPopoverController alloc]
initWithContentViewController:popOver];

myPopOver.delegate = self;
[popOver release];

self.popOverController = myPopOver;
[myPopOver release];

[self.popOverController presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}


After I do some survey, I found that may be I need do some checking using isPopoverVisible property when need display pop over. But I hope I can find out why my application will crash? Anyone know why the above case will occur?

Any comments and ideas are welcome and appreciated. Thanks a lot. :)