我在gist中尝试了相同的代码:https://gist.github.com/barbietunnie/e5547f35180436ac102cac52a15f8ca3
func showModal() {
let modalViewController = ModalViewController()
modalViewController.modalPresentationStyle = .OverCurrentContext
presentViewController(modalViewController, animated: true, completion: nil)
}
class ModalViewController: UIViewController {
override func viewDidLoad() {
view.backgroundColor = UIColor.clearColor()
view.opaque = false
}
}
它的工作正常但是在标签栏的情况下,内容超出标签栏,我们如何才能在标签栏的上/前显示内容?
答案 0 :(得分:3)
通过vc.modalPresentationStyle = .overFullScreen
答案 1 :(得分:0)
我希望它对你有用,
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
let controller = mainStoryboard.instantiateViewController(withIdentifier: "ModalViewController") as! ModalViewController
controller.modalPresentationStyle = .overCurrentContext
谢谢。