0

我正在编写一个涉及从 NSUserDefaults 加载数据的应用程序。因此,当我确认传递的整数为 1 时,我希望它显示某个文本。但是,当我的 .Xib 上没有 UILabel 时。很好,但是一旦我为标签添加了一个出口,将它放在 .Xib 上并将其全部链接起来,它就会出现 SIGABRT

-(void)viewDidLoad {

int page = [[[NSUserDefaults standardUserDefaults] objectForKey:@"Page"] integerValue];

NSString *log = [NSString stringWithFormat:@"%d", page];

NSLog(log);

if (page == 1 ) {
    NSLog(@"redstone block");
title.text = @"redstone Blcok";
}


[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}

我得到的错误:

2013-04-09 18:16:13.910 redstoneGuide[94905:c07] -[UILabel copyWithZone:]:无法识别的选择器发送到实例 0x756b910 2013-04-09 18:16:13.911 redstoneGuide[94905:c07] * 终止应用程序uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x756b910' * First throw call stack: (0x1599012 0x12a6e7e 0x16244bd 0x1588bbc 0x158894e 0x12baae9 0x2cd32b 0xcd45be 0xcd40e7 0xcfeb58 0x408019 0x12ba663 0x159445a 0x406b1c 0x2cb7e7 0x2cbdc8 0x2cbff8 0x2cc232 0x2d7c25 0x4d73a3 0x2d4ee3 0x2d5167 0x33cc 0x12ba705 0x1ee2c0 0x1ee258 0x2af021 0x2af57f 0x2ae6e8 0x4b21d3 0x1561afe 0x1561a3d 0x153f7c2 0x153ef44 0x153ee1b 0x25fa7e3 0x25fa668 0x1eaffc 0x1fcd 0x1ef5) libc++abi.dylib: terminate called throwing an exception (lldb)

4

1 回答 1

0

事实证明你做不到

Iboutlet uilabel *title;

名称 title 会导致应用程序崩溃。但是,以下工作。

Iboutlet uilabel *Gtitle
于 2013-04-12T05:37:12.137 回答