• 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
Re: Question about popover being dismissed clicking outside it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about popover being dismissed clicking outside it


  • Subject: Re: Question about popover being dismissed clicking outside it
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Wed, 26 May 2010 15:07:26 -0400

Sorry - I just needed to remove that check for nil and do this:

[self.popoverController dismissPopoverAnimated:NO];
self.popoverController = nil;
... then create

On Wed, May 26, 2010 at 3:03 PM, Eric E. Dolecki <email@hidden> wrote:

>  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?
>
>
>


--
http://ericd.net
Interactive design and development
_______________________________________________

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

References: 
 >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: NSTextFieldCell + Transparent NSTableView = Black Field editor
  • Previous by thread: Question about popover being dismissed clicking outside it
  • Next by thread: Re: Cocoa-dev Digest, Vol 7, Issue 585
  • Index(es):
    • Date
    • Thread