// 1. 给UITextView添加一个可点击的UIControl UIControl *control = [[UIControl alloc] initWithFrame:_inputView.bounds]; [control addTarget:self action:@selector(inputViewTapHandle) forControlEvents:UIControlEventTouchUpInside]; [_inputView addSubview:control];
#pragma mark - 从别的inputView切换为系统键盘 - (void)inputViewTapHandle { MyLog(@"%s", __FUNCTION__); [_inputView becomeFirstResponder]; _inputView.inputView = nil; [_inputView reloadInputViews]; }
- (void)addBtnClick { [_inputView resignFirstResponder]; MyLog(@"%s", __FUNCTION__); UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)]; view.backgroundColor = [UIColor grayColor]; _inputView.inputView = view; [_inputView becomeFirstResponder]; } - (void)smileBtnClick { [_inputView resignFirstResponder]; MyLog(@"%s", __FUNCTION__); UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)]; view.backgroundColor = [UIColor orangeColor]; _inputView.inputView = view; [_inputView becomeFirstResponder]; }