Ios 弹出窗口显示为全屏
我想在视图控制器内显示视图控制器。我正在使用弹出序列来完成这项工作。第二视图控制器设置如下所示,但无论如何它都会全屏显示Ios 弹出窗口显示为全屏,ios,iphone,swift,popup,segue,Ios,Iphone,Swift,Popup,Segue,我想在视图控制器内显示视图控制器。我正在使用弹出序列来完成这项工作。第二视图控制器设置如下所示,但无论如何它都会全屏显示 func tappedView3() { // get a reference to the view controller for the popover let popController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier:
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
}
对此,您应该使用容器视图 请在此处阅读更多信息: 您可以在其他控制器中使用它,方法如下
let lifeStyleTablePopup = TablePopupController(nibName: NibName.TablePopupController.rawValue, bundle: nil)
self.present(self.lifeStyleTablePopup, animated: true, completion: {
})
我希望这将有助于您了解containerview,但我的问题是,我正在通过按钮打开第二个视图,当打开新的container视图时,该按钮将消失。例如,当我搜索时,该按钮应该仍在视图中。@EmreÖnder,容器视图就是视图。可以将其添加为主视图控制器的子视图。
let lifeStyleTablePopup = TablePopupController(nibName: NibName.TablePopupController.rawValue, bundle: nil)
self.present(self.lifeStyleTablePopup, animated: true, completion: {
})