作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我已经用 ScrollView(与 View 大小相同)填充了我的 View ,但当用户点击 View (或 ScrollView )中的其他地方时,我仍然不知道如何退出第一响应者。关于如何做到这一点的任何想法?我正在使用以下方法,但它没有按预期工作:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
感谢您的帮助,
史蒂芬
最佳答案
我找到了答案 here :
If your ultimate aim is just to resign the first responder, thisshould work:
[self.view endEditing:YES]
endEditing(_:)
方法是为它设计的
Causes the view (or one of its embedded text fields) to resign the first responder status.
关于iphone - 当用户点击其他地方时,如何从文本字段中退出第一响应者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7794959/
我是一名优秀的程序员,十分优秀!