我在一个视图控制器上有多个文本字段。我的 .m 和 .h 在下面。我是 Xcode 和 Objective-C 的新手,所以如果这只是一个愚蠢的错误,请多多指教。
。H:
#import <UIKit/UIKit.h>
@interface MainUI : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *letters;
@property (weak, nonatomic) IBOutlet UISegmentedControl *par;
@property (weak, nonatomic) IBOutlet UISegmentedControl *basicSym;
@property (weak, nonatomic) IBOutlet UITextField *numLetters;
@property (weak, nonatomic) IBOutlet UIButton *mainBack;
@property (weak, nonatomic) IBOutlet UIButton *mainNext;
@end
米:
#import "MainUI.h"
@interface MainUI ()
@end
@implementation MainUI
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (BOOL)textFieldShouldReturn: (UITextField*)theTextField {
if (theTextField == self.textField) {
[theTextField resignFirstResponder];
}
return YES;
}
@end
错误出现在(theTextField == self.textField) {
请帮忙吗?