2012-11-13 115 views

回答

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]; 
} 
相關問題