onl1ner/STTextView

Multiple line placeholder

vikgor opened this issue · 4 comments

I have a textView in a UITableViewCell, and the cell's height changes dynamically depending on the textView's input - when I add more lines of text or delete some of it.
However, it does not work well with the placeholder's number of lines, and only shows the 1st line of placeholder.

The cell's height changes when I add new lines
3

I am currently going around this by making my placeholder a UILabel and constantly setting up the constraints for it.

Expected
1
Reality (ignore placeholder color differences)
2

🤔 It is because of this line placeholderTextView.frame = self.bounds. Forgot about the case when the placeholder content's height is greater than the UITextView's height. I'm gonna add some new logic, but could you please tell me what sort of behavior are you expecting when the person starts typing?

The moment they start typing the height is for one line of text, then the behavior is like on the 1st image (multiple lines of text) and if they clear the text, the height goes back down to what it's supposed to be (depending on the lines in placeholder) and the placeholder is shown.
It may depend on the shouldHidePlaceholderOnEditing property too, and change the height when the placeholder is shown.
Hope it makes sense

I have pushed a new version to a master branch so could you please update the pod from there. I wish it will fix your problem.

Use this to update from master:

  • In your Podfile:
pod 'STTextView', :git => 'https://github.com/onl1ner/STTextView.git'
  • In terminal:
$ pod update

Closing this issue due to inactivity. Please reopen if you still facing with that problem.