小编Xco*_*der的帖子

在UILabel上设置文本会导致我的应用程序崩溃

所以我设置了我的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)

谢谢!

iphone objective-c nsstring uilabel ios

1
推荐指数
1
解决办法
2969
查看次数

标签 统计

ios ×1

iphone ×1

nsstring ×1

objective-c ×1

uilabel ×1