UITextView有inputView 和 inputAccessoryView 两个属性,都指定了对应的视图。 inputAccessoryView 对象显示在 inputView 对象的上面。与输入相关的另一个 reloadInputViews 方法用来又一次加载输入视图。如图:
代码:
if (bt.selected == YES) { bt.selected = NO; [m_textView setInputView:nil]; [m_textView becomeFirstResponder]; }else if(bt.selected == NO){ addEmojiImgView = [AddEmojiImgView initEmojiImgView]; [m_textView setInputView:addEmojiImgView]; bt.selected = YES; [m_textView becomeFirstResponder]; } [m_textView reloadInputViews];