【发布时间】:2012-08-14 20:59:55
【问题描述】:
所以我已经设置了我的 UILabel,但是当我将游戏循环中的文本设置为作为分数的字符串时(因此文本在每个循环中重置),我的应用程序崩溃了。
这是我得到的错误:
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];
谢谢!
【问题讨论】:
-
您是否在 .h 文件中定义了 UILabel ?
标签: iphone objective-c ios nsstring uilabel