解决方法
这将是一个有点棘手的修复.您需要观察UITextView的contentSize属性,然后调整其contentSize& contentOffset是这样的:
- (void) viewDidLoad { [self.textView addObserver:self forKeyPath:@"contentSize" options:(NSKeyValueObservingOptionNew) context:NULL]; [super viewDidLoad]; } - (void)observeValueForKeyPath:(NSString *)iKeyPath ofObject:(id)iObject change:(NSDictionary *)iChange context:(void *)iContext { UITextView *myTextView = (UITextView *)iObject; CGFloat topCorrect = (myTextView.bounds.size.height - [myTextView contentSize].height * [myTextView zoomScale]) / 2.0; topCorrect = (topCorrect < 0.0 ? 0.0 : topCorrect); myTextView.contentOffset = (CGPoint){.x = 0,.y = -topCorrect}; }