0

I use EGOTextView to show some Attributed string like emotion (not emoji), because system's UITextView or UITextField can not show image with text.

But I cannot get the inputView with EGOTextView, How can I get it? Thanks.

ZhouQi
  • 531
  • 1
  • 6
  • 16

2 Answers2

1

The inputView property is defined as read-only in UIResponder, which is a superclass of EGOTextView. So you just need a way to make your instance of EGOTextView return something non-nil from inputView.

Make a subclass of EGOTextView that declares and implements a readwrite version of the inputView property, and use your subclass.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • I think the inputView should be keyboard view, but how I can get the instance of keyboard? – ZhouQi Jun 27 '13 at 23:36
  • You can't get an instance of the keyboard. You can use `inputView` to display something *instead of* the keyboard. If you just want the keyboard, then `inputView` should return nil (which is the default). – rob mayoff Jun 27 '13 at 23:37
  • Yes, the inputView is nil when the keyboard is shown. thank you! – ZhouQi Jun 28 '13 at 01:31
0

If you had checked the implementation of EGOTextView you had find that this class is not a subclass of UITextView1 orUITextFieldso it doesn't haveinputView`.

danypata
  • 9,895
  • 1
  • 31
  • 44
  • [`UIResponder` declares `inputView`.](http://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006783-CH4-SW22) It just doesn't provide a setter for changing it. Any subclass of `UIResponder` (which means any view) can override `inputView` to return something non-nil. – rob mayoff Jun 27 '13 at 22:55
  • Yes, it doesn't subclass of UITextView or UITextField, but when the EGOTextView becomeFirstResponder really has a keyboard pop up, can I get the view to set into inputView? – ZhouQi Jun 27 '13 at 23:40