【问题标题】:Text blurs of UILabel on applying Pinch GestureUILabel 在应用捏合手势时的文字模糊
【发布时间】:2014-05-29 04:37:15
【问题描述】:


我正在使用 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];
         }
    }
}

【问题讨论】:

  • 请帮忙什么?请告诉我们出了什么问题。

标签: ios objective-c uitextfield uilabel uipinchgesturerecognizer


【解决方案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];       
}

希望对您有所帮助!让我知道这是否是您正在寻找的。​​p>

已编辑:

试试这个:

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

}

【讨论】:

  • 不,它不起作用。我们可以通过 UILabel 的框架设置字体大小吗??
  • 通过UILabel的框架设置字体大小是什么意思?能举个例子吗?
猜你喜欢
  • 1970-01-01
  • 2012-12-08
  • 1970-01-01
  • 2019-06-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多