Xcode问题无法使代码正常工作

时间:2013-05-29 04:22:31

标签: xcode mobile

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

感谢。

2 个答案:

答案 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];
}