Dismissing iPad UIPopoverController from within it's content controller

Posted by joshholat on Stack Overflow See other posts from Stack Overflow or by joshholat
Published on 2010-04-17T21:34:17Z Indexed on 2010/04/17 21:43 UTC
Read the original article Hit count: 617

Filed under:
|
|

So I have a popover with a button in it. When that button is pushed, I want the popover to go away. It seems easy enough, but I can't figure it out for the life of me. The code I use to show the popover is below:

AddCategoryViewController* content = [[AddCategoryViewController alloc] init];

UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:content]; aPopover.delegate = self; [content release];

// Store the popover in a custom property for later use. self.addCategoryPopover = aPopover; [aPopover release]; [addCategoryPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

Within the addcategoryviewcontroller, I have:

-(IBAction)saveAddCategory:(id)sender {

if (rootViewController == nil) rootViewController = [[RootViewController alloc] init];

[rootViewController.addCategoryPopover dismissPopoverAnimated:YES]; [rootViewController dismissPopover]; }

Rootviewcontroller is where the popover is being created from. Unfortunately, neither of those methods work to dismiss it. any help?

© Stack Overflow or respective owner

Related posts about uipopovercontroller

Related posts about ipad