IOS7 Uitextview cursor Problem

Source: Internet
Author: User

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

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.