标签:ios
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)
}UIPopoverPresentationController的使用
标签:ios
原文地址:http://blog.csdn.net/rainlesvio/article/details/40151509