View Full Version : Closing a popover with a button (within another .xib file)

May 19, 2011, 08:45 AM
I've got a popover within my view. Within this popover there is content from another xib file (Infoscreen.xib). How can I dismiss the popover with a button which is inside another .xib file? Here's a snippit of my code:

-(IBAction)infoDruk: (id)sender {

if([popover isPopoverVisible]) {
[popover dismissPopoverAnimated:YES];

else {

Infoscreen *choser = [[Infoscreen alloc] init];
popover = [[UIPopoverController alloc]
[choser release];
popover.delegate = self;
popover.popoverContentSize = CGSizeMake(230, 563);
[popover presentPopoverFromBarButtonItem:sender

Help is greatly appreciated!

May 19, 2011, 08:59 AM
There doesn't seem to be a "popoverController" property in UIViewController which is a shame. So create on in Infoscreen and set it in the method you have posted. This will give methods in your Infoscreen instance access to the UIPopoverController instance.