当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - Closing a popover with a button (within another .xib file)

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: