2016-12-31 94 views
0

我跟着這個UIPopoverPresentationController on iPhone doesn't produce popover,但不會在iphone上產生popover。 這裏是視圖 - 控制popover不顯示在iPhone上

class ViewController:UIViewController,UIPopoverPresentationControllerDelegate{ 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     // Do any additional setup after loading the view. 
    } 

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 

     if segue.identifier == "second"{ 

      let secondVC = segue.destination 
      let controller : UIPopoverPresentationController = secondVC.popoverPresentationController! 
      controller.delegate = self 
     } 
    } 

    /* Popover delegate method */ 
    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle { 
     return UIModalPresentationStyle.none 
    } 
} 

我使用存在於iphone酥料餅是不是能展現新的視圖 - 控制的代碼。 (IOS 10/xcode8)

After clicking on button secondViewController should popover on that button.

+0

這個問題是有點混亂:你說「不生產的iphone酥料餅」(即酥料餅不顯示),但你這個題目爲「不叫委託方法」。如果它是前者(popover不顯示),你能顯示你如何(嘗試)調出並顯示popover的代碼嗎? –

+0

@MichaelDautermann我添加了故事板的截圖。 – Rakesh

回答

0

使用該委託方法它是在生產iphone後酥料餅。

func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle { 

    return UIModalPresentationStyle.none 
}