iOS 动画开发全解析:从基础到高级应用
1. 基础动画与 UIView.animate
在 iOS 开发中,基础动画是让应用界面更加生动的重要手段。使用 UIView.animate 可以实现简单的动画效果。例如,下面的代码展示了一个缩放动画,点击单元格后,联系人图像先缩小再恢复原状,最后进行视图跳转:
UIView.animate(withDuration: 0.1, delay: 0, options: [.curveEaseOut], animations: {
cell.conatctImageView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
}, completion: { finished in
UIView.animate(withDuration: 0.1, delay: 0, options: [.curveEaseIn], animations: {
cell.conatctImageView.transform = CGAffineTransform.identity
}, completion: { [weak self] finished in
self?.performSegue(withIdentifier: "detailViewSegue", sender:self)
})
})
运行应用,你会看到精美的动画效果,随后立即跳转到 DetailViewController ,在那里你将看
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



