您的位置:首页 > 移动开发 > IOS开发

iOS系统键盘和自定义键盘的切换

2016-03-27 11:33 651 查看
// 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];
}


             
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: