
312
|
第
10
章
UIView.animate(withDuration: 0.1) { () -> Void in
self.center = self.currentSlot!.center
}
default:
() //
什么也不做
}
//
如果拖放结束或取消,删除前面的
//
转换动画
if dragGesture.state == .ended ||
dragGesture.state == .cancelled {
UIView.animate(withDuration: 0.1) { () -> Void in
self.transform = CGAffineTransform.identity
}
}
}
//
删除卡牌时,使用一个淡出动画
func delete() {
UIView.animate(withDuration: 0.1, animations: { () -> Void in
self.alpha = 0.0
}) { (completed) -> Void in
self.removeFromSuperview()
}
}
//
这个初始化方法是必须的,因为我们继承了
// UIImageView
类。
required init?(coder aDecoder: ...