作者:海峡整形美容医院少校 | 来源:互联网 | 2023-05-16 03:42
Like seriously after going through this...
经过这个......
Easy way to dismiss keyboard?
轻松解除键盘的方法?
... I have multiple TextFields
and a few TextViews
. Is there not a way to a have a batch or group Dismiss First Responder for all text fields? Will I need to make method for each field? Maybe I overlooked something in that link?
...我有多个TextFields和一些TextViews。是否有办法让所有文本字段都有批处理或组Dismiss First Responder?我需要为每个领域制作方法吗?也许我忽略了那个链接中的某些东西?
Maybe I can follow something like this:
也许我可以遵循这样的事情:
https://stackoverflow.com/questions/3282837/problem-with-multiple-textfields-to-make-the-keyboard-dissapear
Would the latter make sense? Thanks in advance.
后者会有意义吗?提前致谢。
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I figured it out....
我想到了....
Controller.h
@interface Controller : UIViewController {
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;
}
4 个解决方案