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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to