Display and dismiss a modal view controller in Swift

前端 未结 5 1190
栀梦
栀梦 2021-02-04 01:01

When a button is pressed I want to segue between two view controllers by using a Modal Transition style CoverVertical and then dismiss it. There is allot of info ou

5条回答
  •  半阙折子戏
    2021-02-04 01:20

    Its pretty easy :

    to dismiss a modal view with swift 3.0 : Use dismiss Api like below :

    > @IBAction func dismissClick(_ sender: Any) {
    >         dismiss(animated: true, completion: nil)
    >         
    >     }
    

    For present :

    > @IBAction func dismissClick(_ sender: Any) {
    > present(UIViewController(), animated: true, completion: nil)
    >         
    >     }
    

    For more details here you go :

    https://developer.apple.com/documentation/uikit/uiviewcontroller#//apple_ref/doc/uid/TP40006926-CH3-SW96

提交回复
热议问题