问题描述:

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]

initWithContentViewController:choser];

[choser release];

popover.delegate = self;

popover.popoverContentSize = CGSizeMake(230, 563);

[popover presentPopoverFromBarButtonItem:sender

permittedArrowDirections:UIPopoverArrowDirectionAny

animated:YES];

}

}

Help is greatly appreciated!

网友答案:

Your another xib should inform (give a call back) to your pop over that such button has been pressed. This concept is called delegates. Thus, you can dismiss the pop over in this call back method.

相关阅读:
Top