IOS uitextview Adaptive Height uitextcontainerview jitter problem

Source: Internet
Author: User

When creating a comment input box similar to a friend's circle, you need to dynamically adjust the height of the input box,

However, after adjusting the height of the Uitextview, the continuation of the input will cause the content (text in the Uitextcontainerview) to wobble.

The scrollrangetovisible method solves my Problem (Swift 3):

Textview.scrollrangetovisible (Nsrange.init (location:0, length:0))

  

How to get the text height and number of lines in Uitextview (Swift 3):

Let height = textview.sizethatfits (cgsize.init (width:textView.frame.size.width, Height: cgfloat.greatestfinitemagnitude). Heightlet line = Int (height/(Textview.font?). lineheight)!)

  

Reprint Please specify source:http://www.cnblogs.com/ficow/p/7225465.html

IOS uitextview Adaptive Height uitextcontainerview jitter problem

Related Article

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.