SHNDTransition
示例
要运行示例项目,请克隆仓库,然后从 Example 目录中先运行 pod install
。
如果您是 SEGUE 的粉丝,那么您一定会非常喜欢这个!
步骤 1
将您的 segue 类型设置为 显示详情
。
步骤 2
在您的 FirstViewController 类中创建 SHNDTransitionController
的实例 👇🏻
let transitionDelegate = SHNDTransitionController(animationDuration: 0.5,
presentTransitionMode: .downToUp,
dismissTransitionMode: .leftToRight)
presentTransitionMode
和 dismissTransitionMode
只是非常简单的枚举,代表了过渡动画的模式。
步骤 3
此步骤发生在您的 func prepare(for segue: UIStoryboardSegue, sender: Any?)
中,如下所示:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let destination = segue.destination as? SecondViewController else { return }
destination.transitioningDelegate = self.transitionDelegate
}
第4步
在你的SecondViewController类中,你只需关闭UIViewController,在这里我使用一个UIButton关闭了它,你可以使用任何你想要的方式关闭它
@IBAction func dismissVC(_ sender: UIButton) {
self.dismiss(animated: true, completion: nil)
}
需求
Swift 4.0或更高版本
安装
SHNDTransition可以通过CocoaPods安装。要安装它,只需将以下行添加到你的Podfile中
pod 'SHNDTransition'
作者
[email protected],《a href="/cdn-cgi/l/email-protection#eb988a838a858f998a8e829882ab928a838484c5888486">[email protected]
许可
SHNDTransition遵循MIT许可。有关更多信息,请参阅LICENSE文件。