Question about popover being dismissed clicking outside it
Question about popover being dismissed clicking outside it
- Subject: Question about popover being dismissed clicking outside it
- From: "Eric E. Dolecki" <email@hidden>
- Date: Wed, 26 May 2010 15:03:07 -0400
I have a UITabBar and a button in it. I am calling up a popover on the
button, but I want to make sure I only ever have one. And when the iPad is
rotated, remove the popover (I don't want it up anymore at that point). How
do I detect an event where the popover is dismissed by clicking outside the
control? If it's removed like that, my check for nil shows that it still
exists...
- (void) accountAction:(id)sender {
//Only one menu please.
if( self.popoverController != nil ){
NSLog(@"already exists");
return;
}
UIViewController *popoverContent = [[UIViewController alloc] init];
UIView *popoverview = [[UIView alloc]
initWithFrame:CGRectMake(0,0,300,400)];
popoverview.backgroundColor = [UIColor blueColor];
popoverContent.view = popoverview;
popoverContent.contentSizeForViewInPopover = CGSizeMake(300, 400);
self.popoverController = [[UIPopoverController alloc]
initWithContentViewController:popoverContent];
[self.popoverController presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:NO];
[popoverview release];
[popoverContent release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//This fails if one clicks outside popover to dismiss it.
if (self.popoverController != nil){
[self.popoverController dismissPopoverAnimated:YES];
self.popoverController = nil;
}
return YES;
}
I would need to make sure that the popoverController is set to nil when it's
dimissed by clicking outside it. How would I do that?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden