1

当我尝试执行此 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

谢谢。

4

2 回答 2

0

在.h

#import <UIKit/UIKit.h>

@interface BIDViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *numberField;
@property (weak, nonatomic) IBOutlet UITextField *nameField;
- (IBAction)textFieldDoneEditing:(id)sender;

- (IBAction)textFieldDoneEditing:(id)sender
{
    [sender resignFirstResponder];
}
于 2013-05-29T11:37:27.663 回答
0
[sender resignFirstResponder];

您不能在.h文件中执行此操作。去掉它。那属于.m.

于 2013-05-29T05:16:23.337 回答