我正在制作一个应用程序,当您按下按钮时,它会给您一个随机图像。当我运行它时,我没有收到任何错误,但是当我单击按钮时,应用程序冻结,并且在 xcode 上,它在此代码的末尾显示“线程 1:断点 1.1”:
-(void)changeLabel{
progressView.progress += 0.15;
if (progressView.progress == 1) {
label.hidden = YES;
progressView.hidden = YES;
[timer invalidate];
imagenesTest.hidden = NO;
int randomNumber = arc4random() % 4;
switch (randomNumber) {
case 0:
imagenesTest.image = [UIImage imageNamed:@"image1.png"];
break;
case 1:
imagenesTest.image = [UIImage imageNamed:@"image2.png"];
break;
case 2:
imagenesTest.image = [UIImage imageNamed:@"image3.png"];
break;
case 3:
imagenesTest.image = [UIImage imageNamed:@"image4.png"];
default:
break;
}
}
}
当我按下一个按钮时,它应该激活一个进度条,然后放置随机图像。它在进度条开始工作之前给出错误。这是我的按钮代码:
- (IBAction)scan:(id)sender {
label.hidden = NO;
imagenesTest.hidden = YES;
progressView.hidden = NO;
progressView.progress = 0;
timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeLabel) userInfo:nil repeats:YES];
}
当我单击线程时,它会突出显示我
0x94feb6: jmp 0x3ef05
; -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 4724
我对代码做错了吗?对不起,如果我没有很好地解释自己,我几个月前开始编程
谢谢你,埃米利奥