Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UILabel blurred text using UIPinchGestureRecognizer

I have a UILabel; when I enlarge it using UIPinchGestureRecognizer, the text becomes blurred. before

after

I use CGAffineTransformScale my code

self.myLabel.transform = CGAffineTransformScale(self.myLabel.transform, pinchRecognizer.scale, pinchRecognizer.scale);

How to fix it?

like image 832
Alisher Avatar asked Nov 26 '25 22:11

Alisher


1 Answers

I found how to solve this problem, it was so easy.

give scale:

CGFloat scale =  self.myLable.transform.a *pinchRecognizer.scale *[UIScreen mainScreen].scale;

this a - (self.myLable.transform.a) return current scale factor.

 self.myLable.transform = CGAffineTransformScale(self.myLable.transform, pinchRecognizer.scale, pinchRecognizer.scale);
[self.myLable setContentScaleFactor:scale];

Done, happy coding!

like image 103
Alisher Avatar answered Nov 28 '25 11:11

Alisher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!