SwipeUpView
截图
安装
SwipeUpView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'SwipeUpView'
SwipeUpViewDatasource
extension ViewController : SwipeUpViewDatasource {
func hideHeaderButton(_ swipeUpView: SwipeUpView) -> Bool {
return false
}
func heightOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
return 8.0
}
func widthOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
return 50.0
}
func marginOfHeaderButton (_ swipeUpView : SwipeUpView) -> CGFloat {
return 4.0
}
func colorOfHeaderButton (_ swipeUpView : SwipeUpView) -> UIColor {
return .white
}
func firstOpenHeightIndex(_ swipeUpView: SwipeUpView) -> Int {
return 1
}
////SETTING HEIGHTS
//if heights returns a non-empty CGFloat array, heightPercentages return value is not important
func heights(_ swipeUpView: SwipeUpView) -> [CGFloat] {
return [100, 300, 600]
}
func heightPercentages(_ swipeUpView: SwipeUpView) -> [CGFloat] {
return [0.1, 0.5, 0.95]
}
////
////SETTING HEIGHTS - 2
//if heights returns an empty CGFloat array, heightPercentages return value will be used
func heights(_ swipeUpView: SwipeUpView) -> [CGFloat] {
return []
}
func heightPercentages(_ swipeUpView: SwipeUpView) -> [CGFloat] {
return [0.1, 0.5, 0.95]
}
////
}
SwipeUpViewDelegate
extension ViewController : SwipeUpViewDelegate {
func swipeUpViewStateWillChange (_ swipeUpView : SwipeUpView, stateIndex : Int){
NSLog("SwipeUpView state will change to %i", stateIndex)
}
func swipeUpViewStateDidChange (_ swipeUpView : SwipeUpView, stateIndex : Int){
NSLog("SwipeUpView state did change to %i", stateIndex)
}
func swipeUpViewWillOpen (_ swipeUpView : SwipeUpView){
NSLog("SwipeUpView state will open")
}
func swipeUpViewDidOpen (_ swipeUpView : SwipeUpView){
NSLog("SwipeUpView state did open")
}
func swipeUpViewWillClose (_ swipeUpView : SwipeUpView){
NSLog("SwipeUpView state will close")
}
func swipeUpViewDidClose (_ swipeUpView : SwipeUpView){
NSLog("SwipeUpView state did close")
}
}
作者
Zingat 移动团队
- Yusuf Çınar, https://github.com/cinaryusufiu
- Kadir Kemal Dursun, https://github.com/KadirKemal
许可协议
SwipUpView 基于 MIT 许可协议发布。更多信息请参阅 LICENSE 文件。