user2722667 February 2016

Move element when UITextView expands

I am trying to make a TextView in my scrollview look like the "Hoshi" TextField in this github repo raulriera TextFieldEffects

If I only have a textview with top/left/right constraint it will expand when I enter more text which is right.

But when I add a UIView under it, it will cut off the text if I enter alot of characters, what I want to do is to move the view/line under it along with the textview when it expands.

My constrains for the UIView is top space to textview >= 10 I thought that would move the View when the textview expands but nothing happens, instead the text gets cut off and the view wont move

Here is a image for the constraint:

enter image description here

So how can I make the view move once the textview expands?

Answers


Rajesh R February 2016

Programmatically change the height constraint of the textview based on the text entered.


Rohit KP February 2016

Remove the bottom constraints of the lable it will work as desired.That bottom constraints don't allow your lable to move down as your textView height increases.


user2722667 February 2016

I found a solution.

I had to set the UIView's bottom constraint to be >= low priority (250). That would make it expand together with the textview

Post Status

Asked in February 2016
Viewed 3,181 times
Voted 10
Answered 3 times

Search




Leave an answer