0

重複の可能性:
ズーム付きの UITextview?

UITextviewにズームインおよびズームアウトオプションはありますか?テキストビューをタップすると、テキストをズームしたいです。

これを行う方法を教えてください。

ありがとう。

4

1 に答える 1

1

UITextViewデリゲートでフォントサイズを大きくできる場合、UITextViewをズームしても意味がありません。

UITextView *textView = [UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
UIPinchGestureRecognizer *gestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(changeFontSize:)];
[textView addGestureRecognizer:gestureRecognizer];

- (void)changeFontSize:(UIPinchGestureRecognizer *)gestureRecognizer {
    UITextView *textView = (UITextView *)gestureRecognizer.view;
    float yourFontSize = gestureRecognizer.scale * FONT_SIZE;
    textView.font = [UIFont systemFontOfSize:yourFontSize];
}
于 2012-11-13T14:29:49.310 に答える