IOS7 cursor Issues
A netizen encountered TextView on iOS7 on the last line of the editor to disappear, see the last row, become blind dozen, StackOverflow site has the big God pointed out, is the IOS7 itself bug, plus the following section of code can (user debugging, this mark a bit, Have a problem, welcome the great gods to point out)
| 1234567891011121314151617 |
-(void)textViewDidChange:(UITextView *)textView { CGRect line = [textView caretRectForPosition: textView.selectedTextRange.start]; CGFloat overflow = line.origin.y + line.size.height - ( textView.contentOffset.y + textView.bounds.size.height - textView.contentInset.bottom - textView.contentInset.top ); if ( overflow > 0 ) { // We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it) // Scroll caret to visible area CGPoint offset = textView.contentOffset; offset.y += overflow + 7; // leave 7 pixels margin // Cannot animate with setContentOffset:animated: or caret will not appear [UIView animateWithDuration:.2 animations:^{ [textView setContentOffset:offset]; }]; }} |
IOS7 cursor Issues