UIPopoverPresentationController的使用
by 伍雪颖
let detailsButton: UIBarButtonItem = UIBarButtonItem(title: "PopView", style: UIBarButtonItemStyle.Plain, target: self, action: "displayPopView:") navigationItem.rightBarButtonItem = detailsButton func displayPopView(sender: UIBarButtonItem) { let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) var contentViewController : CountryPopoverViewController = storyboard.instantiateViewControllerWithIdentifier( "PopoverViewController") as CountryPopoverViewController; contentViewController.country = country contentViewController.modalPresentationStyle = UIModalPresentationStyle.Popover var detailPopover: UIPopoverPresentationController = contentViewController.popoverPresentationController! detailPopover.barButtonItem = sender UIPopoverArrowDirection.Any; presentViewController(contentViewController, animated: true, completion:nil) }
时间: 2024-10-17 10:34:18