2017-04-27 12 views
0

ポップアップコントローラとしてビューコントローラを追加しようとしています。しかし、私はすべて、私はビューが底から滑り落ちるコードを使用し、私は望んでいません。以下は、私がView ControllerをSwift 3.0のポップアップコントローラとして表示できません

let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) 
    let popupVC = storyboard.instantiateViewController(withIdentifier: "WSFilterViewController") as! WSFilterViewController 
    popupVC.modalPresentationStyle = UIModalPresentationStyle .popover 
    popupVC.preferredContentSize = CGSize (width: 300, height:300) 
    let pVC = popupVC.popoverPresentationController 
    pVC?.permittedArrowDirections = UIPopoverArrowDirection.any 
    pVC?.delegate = self as? UIPopoverPresentationControllerDelegate 
    self.present(popupVC, animated: true, completion: nil) 

を使用していたコード、私は任意の助けが理解されるであろう

enter image description here

を示す画像のようにそれをしたいです。事前に

おかげ

+0

docsと書かれています:水平コンパクト環境では、このオプションはfullScreenと同じように動作します。 – Kubba

+0

あなたはiPadまたはiPhoneデバイスにいますか? –

+0

ソースビュー、sourceRect、およびデリゲートがありません –

答えて

0
let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) 
    let popupVC = storyboard.instantiateViewController(withIdentifier: "WSFilterViewController") 
    popupVC.modalPresentationStyle = UIModalPresentationStyle .popover 
    popupVC.preferredContentSize = CGSize(width: 170, height: 130) 
    popupVC.popoverPresentationController?.delegate = self 
    popupVC.popoverPresentationController?.sourceView = sender as? UIView // button 
    popupVC.popoverPresentationController?.sourceRect = (sender as AnyObject).bounds 
    self.present(popupVC, animated: true, completion: nil) 

問題は別の何かだったと、今それを考え出しました。

ありがとうございました

+0

それでも画面全体を撮影しています@gurmandeep –

関連する問題