Display and dismiss a modal view controller in Swift

前端 未结 5 1121
栀梦
栀梦 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:32

    Swift 5:

    present(UIViewController(), animated: true, completion: nil)
    
    dismiss(animated: true, completion: nil)
    

    Swift 2.2:

    self.presentViewController(true, completion: nil)
    

    Hide/dismiss a view controller:

    self.dismissViewControllerAnimated(true, completion: nil)
    

提交回复
热议问题