Ios Swift:使用UIModalTransitionStyle.flipHorizontal显示黑色视图
我正在尝试实现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
@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之间有什么区别?这是两个不同的东西,请查看苹果的文档。