我正在尝试增加进度条并在标签上显示百分比。但是,当调用“incrementaProgres”函数时,两者都保持不变。IBOutlets
正确链接xib
并测试,当函数被调用时,变量具有正确的值。谢谢
来自代表:
loadingViewController *theInstanceP = [[loadingViewController alloc] init];
[theInstanceP performSelectorOnMainThread:@selector(incrementaProgres:) withObject:[NSNumber numberWithFloat:0.15] waitUntilDone:YES];
加载视图类:
- (void)viewDidLoad
{
[super viewDidLoad];
[spinner startAnimating];
[progress setProgress:0.0];
}
- (void)incrementaProgres: (CGFloat)increment{
[progress setProgress:(progresInc + increment)];
carrega.text = [NSString stringWithFormat: @"%f", (progresInc + increment)];
}