TOMSSuggestionBar icon indicating copy to clipboard operation
TOMSSuggestionBar copied to clipboard

Support UITextViews

Open fatuhoku opened this issue 11 years ago • 2 comments

TOMSSuggestionBar doesn't work with UITextViews at the moment because it works with any UIControl <UITextInput>, which UITextView is not. In fact, UITextView is a subclass of UIScrollView <UITextInput>.

Problem: the suggestion bar normally observes the UIControlEventEditingChanged event, which is only officially emitted by UIControl subclasses. Yet we want TOMSSuggestionBar to support all sorts of controls, like

  • UISearchBar
  • UITextView
  • UITextField

Looking at the class hierarchy their common superclass is UIResponder — this is too high up for UIControl behaviours.

~~Possible Solution: use https://github.com/andrewsardone/UITextView-UIControl~~

fatuhoku avatar Jul 21 '14 15:07 fatuhoku

I agree, that would be nice! What do you mean by solution? Do you mean like UITextView+UIControl should be added as dependency to the project?

tomknig avatar Jul 25 '14 22:07 tomknig

Hmm...

Yes — UITextView+UIControl it works brilliantly — from TOMSuggestionBar's perspective we may need to handle UITextView as a special case, and check for the availability addTarget:action: with respondsToSelector: or something horrible like that.

There's no level of abstraction where UITextView fits in neatly, basically. :(

fatuhoku avatar Jul 26 '14 09:07 fatuhoku