当我尝试执行此XCODE时发生错误。有人能帮我理解吗?错误在第5行。
#import <UIKit/UIKit.h>
@interface BIDViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *numberField;
@property (weak, nonatomic) IBOutlet UITextField *nameField;
- (IBAction)textFieldDoneEditing:(id)sender;
[sender resignFirstResponder];
@end
感谢。
答案 0 :(得分:0)
[sender resignFirstResponder];
您无法在.h
文件中执行此操作。去掉它。这属于.m
。
答案 1 :(得分:0)
in .h
#import <UIKit/UIKit.h>
@interface BIDViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *numberField;
@property (weak, nonatomic) IBOutlet UITextField *nameField;
- (IBAction)textFieldDoneEditing:(id)sender;
in .m
- (IBAction)textFieldDoneEditing:(id)sender
{
[sender resignFirstResponder];
}