应用捏手势时UILabel的文字模糊

时间:2014-05-29 04:37:16

标签: ios objective-c uitextfield uilabel uipinchgesturerecognizer

enter image description here
我正在使用UIPinchGestureRecognizer调整UILabel的大小,但也会使用带有捏合的标签模糊文本。 请帮忙。我正在使用以下代码来捏标签。

-(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];
         }
    }
}

1 个答案:

答案 0 :(得分:1)

请参阅 iOS: Scaling UITextView with pinching?

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

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

    [self textViewDidChange:createTextView];       
}

希望有所帮助!如果您正在寻找,请告诉我。

已编辑:

试试这个:

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

}