开发者

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];
        p开发者_高级运维opover = [[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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜