简体   繁体   English

应用缩拢手势时UILabel的文本模糊

[英]Text blurs of UILabel on applying Pinch Gesture

在此处输入图片说明
I am resizing UILabel with UIPinchGestureRecognizer but also text with label blurs with pinching. 我正在使用UIPinchGestureRecognizer调整UILabel的大小,但也会捏捏带有标签模糊的文本。 Please help. 请帮忙。 I am using following code for pinching label. 我正在使用以下代码来捏标签。

-(void)handlePinchGesture:(UIPinchGestureRecognizer *)pinchGesture
{
    float scale = pinchGesture.scale;
    UIView *view = (UIView *)pinchGesture.view;
    if ([view isMemberOfClass:[UILabel class]]) 
    {
         if (([pinchGesture state] == UIGestureRecognizerStateBegan || [pinchGesture state] == UIGestureRecognizerStateChanged))
         {           
                   [pinchGesture view].transform = CGAffineTransformScale([lbl transform],scale, scale);
                   [pinchGesture setScale:1];
         }
    }
}

See iOS: Scaling UITextView with pinching? 请参阅iOS:缩放以缩放UITextView吗?

- (void)scaleTextView:(UIPinchGestureRecognizer *)pinchGestRecognizer{
     CGFloat scale = pinchGestRecognizer.scale;

    createTextView.font = [UIFont fontWithName:createTextView.font.fontName size:createTextView.font.pointSize*scale];

    [self textViewDidChange:createTextView];       
}

Hope that helps! 希望有帮助! Let me know if this is what you are looking for. 让我知道这是否是您想要的。

Edited : 编辑:

Try this: 尝试这个:

-(void)pinchLabel:(UIPinchGestureRecognizer *)recognizer{
CGFloat pinchScale = recognizer.scale;
_lblDouble.font = [UIFont systemFontOfSize:14.0*pinchScale];

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM