Pit 1:
IOS7 and above, uitextview this problem: when the keyboard pops up, no text is entered, but the cursor position is not at the top.
Solution: IOS7 A new attribute automaticallyadjustsscrollviewinsets, set it to No. Don't forget to add the version judgment.
if (ios7_and_later) { = NO; }
Pit 2:
IOS7 and above, Uitextview input in Chinese, after the input of multiple lines, the cursor will sometimes jump up and down, input text when the content will sometimes go up, the cursor is not displayed. This bug pits a lot of people ah, especially when the chat input box, have to find some non-normal method to solve. All kinds of solutions are not available from the Internet.
- (void) Textviewdidchangeselection: (Uitextview *) TextView {//fix iOS7 Bug (modified by Yue). if(Floor (Nsfoundationversionnumber) >Nsfoundationversionnumber_ios_6_1) {CGRect R=[TextView CaretRectForPosition:textView.selectedTextRange.end]; CGFloat carety= MAX (r.origin.y-textview.frame.size.height + r.size.height +8,0); if(Textview.contentoffset.y < carety && R.ORIGIN.Y! =INFINITY) {Textview.contentoffset= Cgpointmake (0, carety); } } }
IOS7 after Uitextview tips