顶部菜单弹出动画
This commit is contained in:
parent
8d7aecad87
commit
f89962cae9
@ -259,9 +259,10 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
tableView.bounces = false
|
||||
tableView.showsVerticalScrollIndicator = false
|
||||
tableView.isScrollEnabled = false
|
||||
UIView.animate(withDuration: 0.3) {[weak self] in
|
||||
self?.addSubview((self?.tableView)!)
|
||||
}
|
||||
self.addSubview(self.tableView)
|
||||
// UIView.animate(withDuration: 0.3) {[weak self] in
|
||||
//
|
||||
// }
|
||||
|
||||
//展示【结束串流】和【开始串流】
|
||||
showBottomView.frame = CGRect(x: self.tableView.left, y: self.tableView.bottom + 8, width: self.tableView.width, height: 40)
|
||||
@ -343,9 +344,42 @@ extension CCSpatialDisplayTypeView{
|
||||
return
|
||||
}
|
||||
initViews()
|
||||
// let height = tableView.height
|
||||
// tableView.height = 0
|
||||
|
||||
|
||||
let frame = self.tableView.frame;
|
||||
self.tableView.layer.anchorPoint = CGPointMake(0.5, 0)
|
||||
self.tableView.frame = frame
|
||||
|
||||
// zoomInAnimation(view: self.tableView, scale: 0, duration: 0, delay: 0)
|
||||
UIApplication.shared.keyWindow?.addSubview(self)
|
||||
// UIView.animate(withDuration: 0.25) {[weak self] in
|
||||
// self?.tableView.height = height
|
||||
// } completion: { finish in
|
||||
//
|
||||
// }
|
||||
zoomInAnimation(view: self.tableView, scale: 1, duration: 0.25, delay: 0)
|
||||
|
||||
}
|
||||
|
||||
func zoomInAnimation(view: UIView, scale: CGFloat, duration: TimeInterval, delay: TimeInterval) {
|
||||
// 创建缩放动画
|
||||
let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")
|
||||
scaleAnimation.toValue = scale
|
||||
scaleAnimation.fromValue = 0.0
|
||||
scaleAnimation.duration = duration
|
||||
scaleAnimation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
|
||||
scaleAnimation.fillMode = .forwards
|
||||
scaleAnimation.isRemovedOnCompletion = false
|
||||
|
||||
// 执行动画
|
||||
UIView.animate(withDuration: duration, delay: delay, options: [], animations: {
|
||||
view.layer.add(scaleAnimation, forKey: "zoomInAnimation")
|
||||
}, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
public func dismiss() {
|
||||
isShowing = false
|
||||
self.dissMissCallback()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user