MoZhouqi / KMPlaceholderTextView

A UITextView subclass that adds support for multiline placeholder written in Swift.
MIT License
805 stars 141 forks source link

Layout fix: labels doesn't need constraints on booth sides. #14

Closed RealBonus closed 8 years ago

RealBonus commented 8 years ago

Labels requires only one horizontal and one vertical constraint. Try replace textview's bottom constraint with height constraint, and IB will generate warning. Removing tail and bottom constraints will fix that.

MoZhouqi commented 8 years ago

It seems to be a duplicate of #13.

RealBonus commented 8 years ago

13 removes width constraint. We can also remove trailing constraint. With trailing, but without width constraints Xcode will generate warning if TextView has it own height constraint, instead of bottom.

MoZhouqi commented 8 years ago

As discussed in #13, in order to ensure the textAlignment property works properly, the trailing and width constraints of placeholderLabel are needed.

The console outputs the warning message which is almost because you forget to set the translatesAutoresizingMaskIntoConstraints property of the placeholderTextView to false.

MoZhouqi commented 8 years ago

Fixed in d670bb34adb98f6f4e328c5e29ed8eafd84838f6.