2017-07-18 9 views
0

Ich möchte einen View-Controller in einem View-Controller anzeigen. Ich benutze popup segue, um dies zu tun. Die Einstellungen der zweiten View-Controller sind wie folgt und es wird trotzdem im Fullscreen angezeigt.Popup wird als Vollbild angezeigt

func tappedView3() { 
    // get a reference to the view controller for the popover 
    let popController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "popoverId") 

    // set the presentation style 
    popController.modalPresentationStyle = UIModalPresentationStyle.popover 

    // set up the popover presentation controller 
    popController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up 
    popController.popoverPresentationController?.delegate = self 
    popController.popoverPresentationController?.sourceView = m_tumgun // button 
    popController.popoverPresentationController?.sourceRect = m_tumgun.bounds 

    // present the popover 
    self.present(popController, animated: true, completion: nil) 
} 

// UIPopoverPresentationControllerDelegate method 
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle { 
    // Force popover style 
    return UIModalPresentationStyle.none 
} 

enter image description here

+0

https://Stackoverflow.com/a/39975346/1702413 – TonyMkenu

Antwort

0
+0

Ich rot über ContainerView, aber mein Problem ist, dass ich zweite Ansicht über eine Schaltfläche öffnen und diese Schaltfläche verschwindet, wenn neue Containeransicht geöffnet. Als ich suchte, sollte zum Beispiel dieser Knopf noch im Blick sein. –

+0

@ EmreÖnder, Containeransicht ist nur Ansicht. Sie können es als Unteransicht Ihres Hauptansicht-Controllers hinzufügen. –

0
class TablePopupController: UIViewController { 
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 
    super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 
    self.modalPresentationStyle = .overCurrentContext 
    self.modalTransitionStyle = .crossDissolve 
} 
required init?(coder aDecoder: NSCoder) { 
    fatalError("init(coder:) has not been implemented") 
} 
/// to touch button which pressed 
/// 
/// - Parameter sender: button presse 
@IBAction func toDismissView(_ sender: AnyObject) { 
    self.handler!(nil) 
    self.dismiss(animated: true, completion: nil) 
} 

Sie es in einem anderen Controller durch folgende Zeile

let lifeStyleTablePopup = TablePopupController(nibName: NibName.TablePopupController.rawValue, bundle: nil) 
self.present(self.lifeStyleTablePopup, animated: true, completion: { 
}) 

ich diesen Willen hoffen können hilft Ihnen

Verwandte Themen