Recently encountered in the project Uitextview on iOS7 on the last line when the cursor disappears, see the last row, become blind hit, StackOverflow on the site has the big God pointed out, is iOS7 itself bug, plus the following section of code can:
1-(void) Textviewdidchange: (Uitextview *) TextView {2CGRect line =[TextView caretrectforposition:3 TextView.selectedTextRange.start];4CGFloat overflow = line.origin.y +Line.size.height5-(Textview.contentoffset.y +TextView.bounds.size.height6-TextView.contentInset.bottom-textView.contentInset.top);7 if(Overflow >0 ) {8 //We are in the bottom of the visible text and introduced a line feeds, scroll down (IOS 7 does don't do it)9 //Scroll Caret to the visible areaTenCgpoint offset =Textview.contentoffset; OneOffset.y + = overflow +7;//leave 7 pixels margin A //cannot animate with SetContentOffset:animated:or caret would not appear -[UIView animatewithduration:.2animations:^{ - [TextView Setcontentoffset:offset]; the }]; - } -}
IOS7 Uitextview cursor Problem