Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cthesky

macrumors member
Original poster
Aug 21, 2011
91
0
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:

Code:
-(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. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.