车辆监控优化
This commit is contained in:
@@ -35,6 +35,8 @@ open class DDUIPanGestureRecognizer : UIPanGestureRecognizer {
|
||||
|
||||
public var panGesValue = PanGesValue.init()
|
||||
|
||||
public var expandLevelChangedHandler : ((_ oldExpandLevel: ExpandLevel, _ newExpandLevel: ExpandLevel) -> Void)?
|
||||
|
||||
/// 会执行默认方法
|
||||
/// - Parameter target: target
|
||||
public init() {
|
||||
@@ -137,6 +139,9 @@ open class DDUIPanGestureRecognizer : UIPanGestureRecognizer {
|
||||
/// 记录当前的currentY
|
||||
panGesValue.currentY = currentY
|
||||
|
||||
/// 上一次expandLevel
|
||||
let oldExpandLevel = panGesValue.expandLevel
|
||||
|
||||
/// 记录当前的expandLevel
|
||||
if panGesValue.currentY == minY {
|
||||
panGesValue.expandLevel = .max
|
||||
@@ -146,6 +151,16 @@ open class DDUIPanGestureRecognizer : UIPanGestureRecognizer {
|
||||
panGesValue.expandLevel = .default
|
||||
}
|
||||
|
||||
/// 新的expandLevel
|
||||
let newExpandLevel = panGesValue.expandLevel
|
||||
|
||||
/// expandLevel改变时回调
|
||||
if oldExpandLevel != newExpandLevel {
|
||||
if let expandLevelChangedHandler = expandLevelChangedHandler {
|
||||
expandLevelChangedHandler(oldExpandLevel,newExpandLevel)
|
||||
}
|
||||
}
|
||||
|
||||
UIView.animate(withDuration: duration, animations: {[weak self] in
|
||||
self?.view?.frame = CGRectMake(viewFrame.origin.x, currentY, viewFrame.size.width, viewFrame.size.height)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user