首页 > 代码库 > UITextView自定义键盘和系统键盘

UITextView自定义键盘和系统键盘

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];