Nicks
Nicks

Reputation: 25

Text blurs of UILabel on applying Pinch Gesture

enter image description here
I am resizing UILabel with UIPinchGestureRecognizer but also text with label blurs with pinching. 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];
         }
    }
}

Upvotes: 0

Views: 975

Answers (1)

z22
z22

Reputation: 10083

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

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

}

Upvotes: 1

Related Questions