Ric*_*evy 3 iphone cocoa-touch uitextfield uiswitch
我的观点有两个UITextFields和一个UISwitch.如果用户编辑a textField,然后立即触摸开关(不按返回),则文本在键入时保留,而不是AutoCorrect.
如果我知道textField他们输入了哪些内容,我可以通过调用强制完成自动更正[textField resignFirstResponder].但是用户可能正在键入textField,所以我不知道要拨打哪一个.
我怎么能绕过这个?有没有办法检测哪些textField被使用?还是我没想过的更简单的东西?
一种可爱的方式,无需跟踪哪个字段处于活动状态:
// This causes the current responder (eg. an input field) to resignFirstResponder and
[self.endEditing:YES];
Run Code Online (Sandbox Code Playgroud)
小智 6
替换[self.view endEditing:YES] 为以下一个......
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2613 次 |
| 最近记录: |