开发者

Iphone SDK: Scaling an image every second

开发者 https://www.devze.com 2023-03-03 09:44 出处:网络
How can i scale an image every second by using an integer?? I want开发者_开发技巧 to do something like this:

How can i scale an image every second by using an integer??

I want开发者_开发技巧 to do something like this:

  • I'l have a time which will decrese 0,025 from an integer that i will use to scale my image.

  • I will also have another timer which would scale the image.

I want the second timer to do something like that:

MyImage.image.size.width * MyInteger

MyImage.image.size.hight * MyInteger

How can i make the scaling animation run smooth like the CGTransform Animations?


I think it's far easier to figure out the duration and the target scale factors than your suggested way. Try this instead:

[UIView animateWithDuration:1.0
                 animations:^{
                    turnDeviceView.transform = 
                       myImageView.transform = 
                         CGAffineTransformMakeScale(0.2, 0.2);      
                 }];

You can even trigger this animation every second, as long as you set the duration less than a second. You can subtract a value from the scale factors to get in the progression you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消