glaszig / SZTextView

A drop-in UITextView replacement which gives you: a placeholder.
MIT License
683 stars 102 forks source link

Support for UITextView's with attributedText and adds attributedPlaceholders #13

Closed benlachman closed 10 years ago

benlachman commented 10 years ago

-- Adds attributedPlaceholder property so that the placeholder may be matched to the main text view in the case that it uses UITextView's attributedText property for mixed formatting. -- Fixes issue with placeholder incorrectly being visible after setting attributedText on main text view by observing attributedText property on the main text view. -- Toggles placeholder visibility on becomeFirstResponder (catches the previous bug and any additional edge cases).

benlachman commented 10 years ago

FYI, before merging (dur) I implemented the exact same abstraction you did in a method named -setPlaceholderVisibleForText:. You might want to consider renaming -togglePlaceholderViewForText: to something a bit more descriptive since "toggle" implies a specific action that goes back and forth regardless of the passed arguments while set<whatever>Visible… might be more descriptive. Apple also uses set<whatever>Visible in several of their APIs.

glaszig commented 10 years ago

great stuff. thanks!

glaszig commented 10 years ago

btw: i added tests for the placeholder sync logic