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

// 1. 给UITextView增加一个可面击的UIControl    UIControl *control = [[UIControl alloc] initWithFrame:_inputView.bounds];    [control addTarget:self];

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

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • iphone开发笔记 退回输入键盘 - (BOOL) textFieldShouldReturn:(id)text...
    爱易寒曲易散阅读 3,751评论 0 1
  • *7月8日上午 N:Block :跟一个函数块差不多,会对里面所有的内容的引用计数+1,想要解决就用__block...
    炙冰阅读 7,311评论 1 14
  • 相信大家在开发中经常会遇到这样的需求,在编辑个人信息界面中,判断用户是否修改信息,如果修改,返回时则添加是否保存的...
    小明的知识库阅读 8,357评论 0 50
  • 最近,网上有一条被疯狂转载的说说。讲的是赵肥和郭姐哒的爱情史,十年坎坷,终于修成正果,扯下了结婚证。他俩的爱情故事...
    岁月如流toto阅读 2,854评论 0 0
  • 这里我不讨论什么是婚姻或者婚姻的好坏。我脑洞一个【生命圈】的概念和你谈谈为什么不一定非要结婚。 假设世界是一个白板...
    蔬菜先生阅读 3,030评论 0 2