cbowns / MPTextView

A UITextView subclass with support for placeholder text (like UITextField)
Apache License 2.0
93 stars 16 forks source link

Multiline placeholder issue #1

Closed gerry3 closed 10 years ago

gerry3 commented 10 years ago

I added a multiline placeholder and it looked great.

Then, I entered some text and deleted it. The placeholder changed to one line and ran off the edge instead of wrapping.

cbowns commented 10 years ago

Can you provide a small sample project? What version of iOS is this on and what device?

gerry3 commented 10 years ago

Were you not able to reproduce as described? This is simulator on iOS 7.

gerry3 commented 10 years ago

We'll put together a sample project today.

gerry3 commented 10 years ago

The sample project worked and I found my bug: I was updating placeholderText in textViewDidChange: (leftover code from my previous custom solution with a separate label).

@cbowns this can be closed either way, but do you expect such weird behavior when updating that property from that delegate method?

cbowns commented 10 years ago

That's wacky. It sounds like the sizeToFit: call in setPlaceholderText: is possibly to blame. UITextView does lots of Weird Things, though, and I haven't tested this at all on 7.0, so I'm not ruling out that it's MPTextView's fault instead of you or UIKit's.

cbowns commented 10 years ago

I didn't try to reproduce: I'm not actively working on the product that I wrote this for, so it's not a trivial exercise to reproduce it. Can you post your sample project somewhere or open a pull request to pull it into this project? I'd love to include something which is small and easy to test with.