0
我們可以在iPhone設備上使用Swift
創建iPad,如UIPopOver
,其中源是UIButton
。我創建了UIPopOver
從UIBarButtonItem
和它的工作正常,但它不工作的情況下UIButton
。任何人都可以提出更好的解決方案儘快。我需要在iPhone設備上工作。UIPopOver來自UIButton for iPhone
我們可以在iPhone設備上使用Swift
創建iPad,如UIPopOver
,其中源是UIButton
。我創建了UIPopOver
從UIBarButtonItem
和它的工作正常,但它不工作的情況下UIButton
。任何人都可以提出更好的解決方案儘快。我需要在iPhone設備上工作。UIPopOver來自UIButton for iPhone
當然可以,但你需要實現的popoverPresentationController
let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("AnnotationInfoViewController") as! PopUpViewController
//If you want to show view from XIB file you can create viewController instance like this
//let viewController = UIViewController()
//let myView = NSBundle.mainBundle().loadNibNamed("PopUpView", owner: self, options: nil)[0] as! PopUpView
//viewController.view = myView
//Pass the information that you want to show
viewController.data = passdata
//Set the viewController for popoverPresentationController
viewController.modalPresentationStyle = .Popover
viewController.preferredContentSize = CGSize(width: viewController.view.frame.size.width, height: 80)
viewController.popoverPresentationController!.delegate = self;
viewController.popoverPresentationController!.permittedArrowDirections = [.Up , .Down]
viewController.popoverPresentationController!.sourceView = yourBtn!
viewController.popoverPresentationController!.sourceRect = yourBtn.frame
self.presentViewController(viewController, animated: true, completion: nil)
代表現在器裏面你ViewController
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return .None;
}
看到這個http://stackoverflow.com/questions/的
popoverPresentationController
這種方法28521583/uipopoverpresentationcontroller-ON-iphone-犯規-農產品-酥料餅 –