Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift:使用UIModalTransitionStyle.flipHorizontal显示黑色视图_Ios_Swift3_Uimodaltransitionstyle_Xcode9.4 - Fatal编程技术网

Ios Swift:使用UIModalTransitionStyle.flipHorizontal显示黑色视图

Ios Swift:使用UIModalTransitionStyle.flipHorizontal显示黑色视图,ios,swift3,uimodaltransitionstyle,xcode9.4,Ios,Swift3,Uimodaltransitionstyle,Xcode9.4,我正在尝试实现UIModalTransitionStyle.flipHorizontal,它可以正常工作,但只显示了一个黑色视图。这是我的密码: @IBAction func loadNextView(_ sender:UIButton){ let nextVC = NextViewController() nextVC.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal self.present(n

我正在尝试实现UIModalTransitionStyle.flipHorizontal,它可以正常工作,但只显示了一个黑色视图。这是我的密码:

@IBAction func loadNextView(_ sender:UIButton){

    let nextVC = NextViewController()
    nextVC.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal
    self.present(nextVC, animated: true, completion: nil)
}
你们有谁知道为什么它显示黑色视图?或者如何显示正确的视图


我非常感谢您的帮助

您需要像这样加载VC[nextID是脚本中的id]

let nextVC  = self.storyboard?.instantiateViewController(withIdentifier: "nextID") as! NextViewController

尝试将显示的视图控制器的modalPresentationStyle设置为overCurrentContext:

nextVC.modalPresentationStyle = .overCurrentContext

NextViewController在故事板中??是的,NextViewController在故事板中。这是可行的。非常感谢。如果要使用相同的UIModalTransitionStyle.flipHorizontal关闭下一个ViewController,请快速提问。如何做到这一点?你可以使用self.dismissanimated:true,completion:nil nextVC.ModalPresentStyle=.overCurrentContext和nextVC.modalTransitionStyle=UIModalTransitionStyle.flipHorizontal之间有什么区别?这是两个不同的东西,请查看苹果的文档。