0

我找到了这个链接,它提供了从 finder 打开我的项目的解决方案。没运气。

我知道我的代码应该可以工作,因为我有一堆 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
4

2 回答 2

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;
于 2012-08-29T06:12:49.033 回答
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;

第 2 行、第 4 行和第 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;
于 2012-08-29T06:49:09.653 回答