하나의보기 컨트롤러에 여러 개의 텍스트 필드가 있습니다. 내 .m과 .h는 아래에 있습니다. 나는 Xcode와 Objective-C에 익숙하지 않으므로 이것이 단지 어리석은 실수라면 친절하게 대해주십시오." 'mainUI *'유형의 객체에서 'textField'속성을 찾을 수 없습니다."
.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
하는 .m :
#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) {
도움으로하시기 바랍니다인가? 당신은 단지 사용자가 돌아 가기를 누르면 커서가 텍스트 필드에있는 동안 키보드 멀리 갈 수 있도록하려는 경우
나는 텍스트 필드] 속성에 정의 된 표시되지 않습니다 제공된 헤더 코드. "letters"및 "numLetters"UITextField 속성이 있지만 "textField"속성은 없습니다. – Alex
self.textField가 MainUI.h에 정의한 속성 중 하나와 일치하지 않습니다. self.letters 또는 self.numLetters를 사용 하시겠습니까? –
각 텍스트 필드마다이 작업을 수행해야합니까? 이 견해에 나는 단지 두 개 뿐이지 만 다른 것들은 더 가지고 있습니다. –