IOS7 after Uitextview skills

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.