本文共 344 字,大约阅读时间需要 1 分钟。
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]textField.returnKeyType = UIReturnKeySearch; //设置按键类型textField.enablesReturnKeyAutomatically = YES; //这里设置为无文字就灰色不可点
在代理方法中响应
- (BOOL)textFieldShouldReturn:(UITextField *)textField{ [self searchAction]; [textField resignFirstResponder]; return YES;}
转载地址:http://nkbyz.baihongyu.com/