adali adali - 1 year ago 120
iOS Question

Anyway to animate a UIImageview's contentMode from aspectFill to aspectFit?

[UIView animateWithDuration:30.0f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^{
v.contentMode = UIViewContentModeScaleAspectFit;
v.frame = v.superview.bounds;
} completion:^(BOOL finished) {
[v removeFromSuperview];

I wanna a UIImageview to resize & change the contentMode, but the code above doesn't work,
it changed the contentMode immediately at the beginning of the animation.

Is there anyway to animate it?

Answer Source

UIImageView inherits its contentMode property from UIView. It is not one of the properties you can animate. More information can be found in the View Programming Guide.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download