0

I can imagine the kinds of things I'd need to do to make this happen without auto layout, but cannot image what kinds of constrains to create to make it work with it.

I have a UITextView that should resize to fit the text as the user types it, with some maximum/minimum values beyond which it will not grow/compress. Is this possible to achieve while using NSLayoutConstraint to lay everything out?

SaltyNuts
  • 5,068
  • 8
  • 48
  • 80
  • 1
    [This question](http://stackoverflow.com/questions/16868117/uitextview-that-expands-to-text-using-auto-layout) may help. – j.f. Jun 12 '15 at 20:40
  • it is possible. create textview of one line. attach leading,trailing,bottom to its superview and give height constraint of greater than equal to 40. this will give minimum height constraint to textivew and as and when you start typing, you need to keep checking if content goes onto second line and increase height by changing constant value of height constraint. – Ruchish Shah Jun 12 '15 at 20:44
  • i have done same thing for one of my chat control, which is going to take multiline chat text in autolayout environment. – Ruchish Shah Jun 12 '15 at 20:44

0 Answers0