Is there any way to resize (in my case increase the width) of an PNG file in an animation? This would need to result into a distortion of the original PNG (in my case, I try to get the PNG fatter).
My code so far is:
pageShadow = [UIImage imageNamed:@"pageshadow.png"]; // load our image resource
pageShadowView = [[UIImageView alloc] initWithImage:pageShadow];
[UIView beginAnimations:@"shadowMove" context:nil]; // Begin animation
[UIView setAnimationDuration:4.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//[pageShadowView setFrame:CGRectMake(0, 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
[UIView commitAnimations];
But I can't think of a command to increase the width of my PNG. I guess this开发者_运维技巧 is not possible as long as it is confined to an UIView, right? I'd be grateful for any suggestions of how to tackle this problem. Thanks, and sorry if this is really obvious or basic.
to do what you want you probably want to add a transform to the view.
try something like
[pageShadowView setTransform:CGAffineTransformMakeScale (2, 1)];
精彩评论