经过这个……
…我有多个TextFields和一些TextViews.是否有办法让所有文本字段都有批处理或组Dismiss First Responder?我需要为每个领域制作方法吗?也许我忽略了那个链接中的某些东西?
也许我可以遵循这样的事情:
后者会有意义吗?提前致谢.
= – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = – = –
我想到了….
Controller.h @interface Controller : UIViewController <UITextFieldDelegate> { IBOutlet UITextField *clickedDone; } @property (nonatomic,retain) IBOutlet UITextField *clickedDone; Controller.m #import "Controller.h" @implementation Controller @synthesize clickedDone; - (void)viewDidLoad { [super viewDidLoad]; [clickedDone setDelegate:self]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; }
解决方法
clickedDone.returnKeyType = UIReturnKeyDone; // in viewDidLoad - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; }