문제

I use this code at viewDidLoad to scale my UIImageView:

imageView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 3.0, 3.0);

Now, I want to go back to its original size, 1.0

I use this action for an UIButton

imageView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);

But doesn't work. What the problem?

도움이 되었습니까?

해결책 2

if you just want to scale the size , use CGAffineTransformMakeScale is easy and will solve your problem.

다른 팁

Every time you scale an image, you have to take the new scale into account. You're first setting the scale to 3x the normal size. Then you're setting it to 1x the "new" size. To go back to the original size, use:

imageView.transform = CGAffineTransformIdentity;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top