位移:
UIView * testView;
UIView.animateWithDuration(1, animations: {
testView.center.x = self.view.bounds.width - testView.center.x;
});
透明:
UIView.animateWithDuration(1, animations: {
testView.alpha = 0;//透明度为0
});
缩小/扩大UIView.animateWithDuration(1, animations: {
testView.transform = CGAffineTransformMarkScale(2.0,2.0);//2.0为倍数(即原来的大小乘以倍数,倍数大于1为扩大,小于1为缩小)
});
颜色改变:UIView.animateWithDuration(1, animations: {
testView.backgroudColor = [UIColor redColor];
});
本文介绍了如何使用iOS的UIView动画来实现位移、透明度变化、缩放及颜色更改等基本动画效果。通过简单的代码示例,展示了如何操作UIView属性以达到所需视觉效果。
2318

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



