我发现this link提供了从发现者打开我的项目的解决方案。没有运气。
我知道我的代码应该可以工作,因为我有一堆UITextfields,其中大约一半是工作的,其中一半没有相同的代码。我怀疑我只是有太多的IBOutlets和Interface Builder因为我有这么多而不能再告诉我了。 (有13个标签和12个文本字段已经完全正常运行,我正在尝试添加12个文本字段)。
Interface Builder是否有某种#-of-outlet限制,这是一个XCode错误,还是Interface Builder中有一个设置我可能会意外更改导致此行为?
编辑: 我的.h文件 - 我为它是多么可怕而道歉。
#import <UIKit/UIKit.h>
#import "MatchSheet.h"
#import "Match.h"
@interface Individual : UIViewController<UIScrollViewDelegate>{
IBOutlet UIScrollView *scroller;
UILabel *label333Team1, *label333Team2, *label363Team1, *label363Team2, *labelCycleTeam1, *labelCycleTeam2;
UILabel *label333Stacker1a, *label333Stacker1b, *label333Stacker2a, *label333Stacker2b, *label363Stacker1a, *label363Stacker1b, *label363Stacker2a, *labet363Stacker2b, *labelCycleStacker1a, *labelCycleStacker1b, *labelCycleStacker2a, *labelCycleStacker2b;
// 333 Attempts
UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
UITextField *field333attempt2a1, *field333attempt2a2, *field333attempt2a3, *field333attempt2b1, *field333attempt2b2, *field333attempt2b3;
// 363 Attempts
UITextField *field363attempt1a1, *field363attempt1a2, *field363attempt1a3, *field363attempt1b1, *field363attempt1b2, *field363attempt1b3;
UITextField *field363attempt2a1, *field363attempt2a2, *field363attempt2a3, *field363attempt2b1, *field363attempt2b2, *field363attempt2b3;
// Cycle Attempts
UITextField *fieldCycleattempt1a1, *fieldCycleattempt1a2, *fieldCycleattempt1a3, *fieldCycleattempt1b1, *fieldCycleattempt1b2, *fieldCycleattempt1b3;
UITextField *fieldCycleattempt2a1, *fieldCycleattempt2a2, *fieldCycleattempt2a3, *fieldCycleattempt2b1, *fieldCycleattempt2b2, *fieldCycleattempt2b3;
}
// Teams //
@property (nonatomic, strong) IBOutlet UILabel *label333Team1, *label333Team2;
@property (nonatomic, strong) IBOutlet UILabel *label363Team1, *label363Team2;
@property (nonatomic, strong) IBOutlet UILabel *labelCycleTeam1, *labelCycleTeam2;
// Stackers //
@property (strong, nonatomic) IBOutlet UILabel *label333Stacker1a, *label333Stacker1b, *label333Stacker2a, *label333Stacker2b;
@property (strong, nonatomic) IBOutlet UILabel *label363Stacker1a, *label363Stacker1b, *label363Stacker2a, *label363Stacker2b;
@property (strong, nonatomic) IBOutlet UILabel *labelCycleStacker1a, *labelCycleStacker1b, *labelCycleStacker2a, *labelCycleStacker2b;
// Attempts //
// 333
@property (strong, nonatomic) IBOutlet UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
@property (strong, nonatomic) UITextField *field333attempt2a1, *field333attempt2a2, *field333attempt2a3, *field333attempt2b1, *field333attempt2b2, *field333attempt2b3;
// 363
@property (strong, nonatomic) IBOutlet UITextField *field363attempt1a1, *field363attempt1a2, *field363attempt1a3, *field363attempt1b1, *field363attempt1b2, *field363attempt1b3;
@property (strong, nonatomic) UITextField *field363attempt2a1, *field363attempt2a2, *field363attempt2a3, *field363attempt2b1, *field363attempt2b2, *field363attempt2b3;
// Cycle
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt1a1, *fieldCycleattempt1a2, *fieldCycleattempt1a3, *fieldCycleattempt1b1, *fieldCycleattempt1b2, *fieldCycleattempt1b3;
@property (strong, nonatomic) UITextField *fieldCycleattempt2a1, *fieldCycleattempt2a2, *fieldCycleattempt2a3, *fieldCycleattempt2b1, *fieldCycleattempt2b2, *fieldCycleattempt2b3;
-(IBAction)switchview:(id)sender;
@end
答案 0 :(得分:0)
您只将IBOutlet放在一些UITextField属性声明的前面。在标题中,请确保将IBOutlet放在所有标题之前,如下所示:
// Attempts //
// 333
@property (strong, nonatomic) IBOutlet UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *field333attempt2a1, *field333attempt2a2, *field333attempt2a3, *field333attempt2b1, *field333attempt2b2, *field333attempt2b3;
// 363
@property (strong, nonatomic) IBOutlet UITextField *field363attempt1a1, *field363attempt1a2, *field363attempt1a3, *field363attempt1b1, *field363attempt1b2, *field363attempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *field363attempt2a1, *field363attempt2a2, *field363attempt2a3, *field363attempt2b1, *field363attempt2b2, *field363attempt2b3;
// Cycle
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt1a1, *fieldCycleattempt1a2, *fieldCycleattempt1a3, *fieldCycleattempt1b1, *fieldCycleattempt1b2, *fieldCycleattempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt2a1, *fieldCycleattempt2a2, *fieldCycleattempt2a3, *fieldCycleattempt2b1, *fieldCycleattempt2b2, *fieldCycleattempt2b3;
答案 1 :(得分:0)
您的密码:
@property (strong, nonatomic) IBOutlet UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
@property (strong, nonatomic) UITextField *field333attempt2a1, *field333attempt2a2, *field333attempt2a3, *field333attempt2b1, *field333attempt2b2, *field333attempt2b3;
// 363
@property (strong, nonatomic) IBOutlet UITextField *field363attempt1a1, *field363attempt1a2, *field363attempt1a3, *field363attempt1b1, *field363attempt1b2, *field363attempt1b3;
@property (strong, nonatomic) UITextField *field363attempt2a1, *field363attempt2a2, *field363attempt2a3, *field363attempt2b1, *field363attempt2b2, *field363attempt2b3;
// Cycle
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt1a1, *fieldCycleattempt1a2, *fieldCycleattempt1a3, *fieldCycleattempt1b1, *fieldCycleattempt1b2, *fieldCycleattempt1b3;
@property (strong, nonatomic) UITextField *fieldCycleattempt2a1, *fieldCycleattempt2a2, *fieldCycleattempt2a3, *fieldCycleattempt2b1, *fieldCycleattempt2b2, *fieldCycleattempt2b3;
第二,第四和第二的错误第6行代码。您没有将UITextField定义为IBOutlet。
将IBOutlet添加到UITextFields,它肯定能正常工作。
新守则:
@property (strong, nonatomic) IBOutlet UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *field333attempt1a1, *field333attempt1a2, *field333attempt1a3, *field333attempt1b1, *field333attempt1b2, *field333attempt1b3;
//363
@property (strong, nonatomic) IBOutlet UITextField *field363attempt1a1, *field363attempt1a2, *field363attempt1a3, *field363attempt1b1, *field363attempt1b2, *field363attempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *field363attempt2a1, *field363attempt2a2, *field363attempt2a3, *field363attempt2b1, *field363attempt2b2, *field363attempt2b3;
// Cycle
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt1a1, *fieldCycleattempt1a2, *fieldCycleattempt1a3, *fieldCycleattempt1b1, *fieldCycleattempt1b2, *fieldCycleattempt1b3;
@property (strong, nonatomic) IBOutlet UITextField *fieldCycleattempt2a1, *fieldCycleattempt2a2, *fieldCycleattempt2a3, *fieldCycleattempt2b1, *fieldCycleattempt2b2, *fieldCycleattempt2b3;