美文网首页
回收键盘

回收键盘

作者: 贼海鸥 | 来源:发表于2017-03-27 16:49 被阅读0次

    UITextField回收键盘
    1.通过代理方法回收键盘

    - (BOOL)textFieldShouldReturn:(UITextField *)textField {
        [textField resignFirstResponder];
        return YES;
    }
    

    2.点击空白区域回收键盘

    // 收回键盘
    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
        [self endEditing:YES];
    }
    

    相关文章

      网友评论

          本文标题:回收键盘

          本文链接:https://www.haomeiwen.com/subject/dumrottx.html