• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Question about popover being dismissed clicking outside it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Question about popover being dismissed clicking outside it
      • From: "Eric E. Dolecki" <email@hidden>
  • Prev by Date: Re: subclass overwriting superclass ivar
  • Next by Date: Re: subclass overwriting superclass ivar
  • Previous by thread: Re: initializing a pdfview
  • Next by thread: Re: Question about popover being dismissed clicking outside it
  • Index(es):
    • Date
    • Thread