iOS键盘回收-按return键盘回收-或者跳入下一个UITextFielf的代码-self方法
iOS键盘回收-按return键盘回收-或者跳入下一个UITextFielf的代码
// 把Text写成属性(延展)
@property (nonatomic, retain) UITextField *field1;
@property (nonatomic, retain) UITextField *field2;
// 键盘回收(第一个UITextField) 添加到 [self.view addSubview.self.field];的前面
self.field1.delegate = self;
// 键盘回收 YIem博客(第二个UITextField) 添加到第二个[self.view addSubview:self.field2];的前面;
self.field2.delegate = self;
// 最后在大括号外面写一下代码
(在- (void)viewDidLoad {
[super viewDidLoad];
}) 的外面重新写一个
// 键盘回收
(BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (textField == self.field1) {[self.field2 becomeFirstResponder];
} else if (textField == self.field2) {
[textField resignFirstResponder];
}
NSLog(@" sa");
// [textField resignFirstResponder];
return YES;
}