我想增加進度條並在標籤上顯示百分比。但是,當「incrementaProgres」函數被調用時,兩者都保持不變。 IBOutlets
在xib
上正確鏈接,並且還測試了當函數被調用時變量具有適當的值。感謝Xcode UIProgressBar不會增加
從委託:
loadingViewController *theInstanceP = [[loadingViewController alloc] init];
[theInstanceP performSelectorOnMainThread:@selector(incrementaProgres:) withObject:[NSNumber numberWithFloat:0.15] waitUntilDone:YES];
loadingView類:
- (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)];
}
謝謝,android讓我忘記了iOS pb的基礎知識:)但是,仍然沒有刷新,雖然vars有適當的價值... – Jaume 2012-04-12 10:36:21
@Jaume是'carrega.text'被設置爲0和1之間的正確值? – dasblinkenlight 2012-04-12 10:40:26
carrega標籤不變,設置爲指定值,但未在視圖上更新 – Jaume 2012-04-12 10:53:53