Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BarryK88

macrumors member
Original poster
Mar 1, 2011
31
0
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:

Code:
-(IBAction)infoDruk: (id)sender {

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

    }
    else {

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

Help is greatly appreciated!
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.