所以我设置了我的UILabel,但是当我将游戏循环中的文本设置为一个得分的字符串(因此每次循环都重置了Text)时,我的应用程序崩溃了.
这是我得到的错误:
0x15560b0:cmpl(%eax),%ecx线程1
断点说:
EXC_BAD_ACCESS(代码= 1,地址= 0x67b30064
以下是我如何设置我的UILabel(在我的init方法中):
//SET UP THE SCORE LABEL HERE
scoreLabel = [[UILabel alloc] init];
scoreString = [NSString stringWithFormat:@"%d", score];
[scoreLabel setFont: [UIFont fontWithName: @"TimesNewRoman" size: 10.0f]];
[scoreLabel setFrame: CGRectMake(262, 250, 100, 40)];
[scoreLabel setBackgroundColor:[UIColor clearColor]];
[scoreLabel setTextColor: [UIColor clearColor]];
[scoreLabel setTextColor: [UIColor whiteColor]];
scoreLabel.transform = CGAffineTransformMakeRotation(89.53);
[self addSubview: scoreLabel];
//[scoreLabel setText: scoreString];
Run Code Online (Sandbox Code Playgroud)
谢谢!