2017-04-27 12 views
0

팝업 제어기로 내 View Controller를 추가하려고합니다. 그러나 모든 것이 내가보기에 밑바닥에서 미끄러지는 코드를 사용하고 내가 원하는대로 사용하지 않습니다. 다음은 어떤 도움을 이해할 수있을 것이다보기 컨트롤러를 Swift 3.0의 팝업 제어기로 표시 할 수 없습니다.

enter image description here

표시 나는 이미지로 원하는 내가

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) 

을 사용하고 코드입니다. 사전

+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 –