在UIView上缩放字体大小UITextView

时间:2015-10-19 13:51:43

标签: ios objective-c uiview uitextview uipinchgesturerecognizer

我的UITextView添加了UIView。它只是显示一个字符串。 当我将UIPinchGestureRecognizer添加到UIView时:

UIPinchGestureRecognizer * pinchGR = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
pinchGR.delegate = self;
[self addGestureRecognizer:pinchGR];

然后我处理UIView的动作并在UITextView中缩放字体大小

- (void)handlePinch:(UIPinchGestureRecognizer *)recognizer {
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
CGFloat currentSize = _textView.font.pointSize;
CGFloat toSize = currentSize * recognizer.scale ;
[_textView setFont:[UIFont systemFontOfSize:toSize]];
recognizer.scale = 1;
}

这是我的结果,我的UITextView显示非常糟糕(不透明)

myIMG

我怎么能像Snapchat一样呢?

snapchatIMG

请给我一些想法。

1 个答案:

答案 0 :(得分:0)

/consumers/

试试这个!!! ...