Swift 具有超越标签栏的透明背景的模态视图控制器

Swift Modal View Controller with transparent background going beyond tab bar

我在要点中尝试了相同的代码: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
    }
}

它工作正常,但在标签栏的情况下,内容超出了标签栏,我们如何才能使标签栏的内容可见 upper/front?

希望对你有用,

let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
let controller = mainStoryboard.instantiateViewController(withIdentifier:  "ModalViewController") as! ModalViewController
controller.modalPresentationStyle = .overCurrentContext

谢谢。

它通过 vc.modalPresentationStyle = .overFullScreen

起作用