当用户点击我的NavigationController提供的下方工具栏上的按钮时,我想在我的iPad应用中显示UIPopoverController。是否有关于如何做到这一点的教程?我发现的只是2010年的古老教程。
提前谢谢。
答案 0 :(得分: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];
}