1

当用户点击我的 NavigationController 提供的下部工具栏上的按钮时,我想在我的 iPad 应用程序中显示一个 UIPopoverController。有没有关于如何做到这一点的教程?我发现的只是 2010 年的古老教程。

先感谢您。

4

1 回答 1

12
-(IBAction)ButtunClickMethod:(id)sender{
 //create the table view controller from nib
        self.tblLisView = [[[tableListVC alloc] 
                                        initWithNibName:@"tableListVC" 
                                        bundle:[NSBundle mainBundle]] autorelease];

        //set popover content size
        tblLisView.contentSizeForViewInPopover = CGSizeMake(170, 170);

        //create a popover controller
        self.popoverController = [[[UIPopoverController alloc]
                                   initWithContentViewController:tblLisView] autorelease];


        //present the popover view non-modal with a
        //refrence to the button pressed within the current view
        [self.popoverController presentPopoverFromRect:popoverButton.frame
                                                inView:self.view
                              permittedArrowDirections:UIPopoverArrowDirectionDown
                                              animated:YES];
}
于 2012-09-27T07:22:44.707 回答