CardStyleTransition
示例
要运行示例项目,请克隆仓库,然后首先从Example目录运行pod install
。
要求
- iOS 10.0+
- Swift 5
安装
CardTransition可以通过CocoaPods获得。要安装它,只需将以下行添加到Podfile中。
pod 'CardStyleTransition'
如何使用
您只需设置自定义过渡处理程序并遵守BottomOverlay协议。
class SecondViewController: UIViewController, BottomOverlayProtocol {
var transitionHandler : BottomOverlayTransitionHandler!
init() {
super.init(nibName: nil, bundle: nil)
self.transitionHandler = BottomOverlayTransitionHandler(presented: self,
interactive: true,
dimmedColor: .blue,
indicatorColor: .yellow,
duration: 1)
transitioningDelegate = transitionHandler
modalPresentationStyle = .custom
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
func bottomOverlayHeight() -> CGFloat {
return 300
}
func bottomOverlayWidth() -> CGFloat {
return min(UIScreen.main.bounds.width, 414 )
}
}
通过实现bottomOverlayHeight()
方法,您可以指定覆盖层的尺寸。如果不实现此方法,将应用适合容器的最小高度。
作者
许可
CardStyleTransition在MIT许可下可用。有关更多信息,请见LICENSE文件。