ada*_*ali 4 animation uiimageview ios
[UIView animateWithDuration:30.0f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^{
v.contentMode = UIViewContentModeScaleAspectFit;
v.frame = v.superview.bounds;
} completion:^(BOOL finished) {
[v removeFromSuperview];
}];
Run Code Online (Sandbox Code Playgroud)
我想要一个UIImageView调整大小并更改contentMode,但上面的代码不起作用.它在动画开始时立即更改了contentMode.
有什么方法可以动画吗?
正如其他人所提到的,没有办法为contentMode制作动画.
这个库的存在是为了解决这个问题! https://github.com/patrickbdev/PBImageView
imageView.contentMode = .scaleAspectFit
UIView.animateWithDuration(1) {
self.imageView.contentMode = .scaleAspectFill
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4470 次 |
| 最近记录: |