2
我不明白我躺在哪裏的雞蛋。我需要更新progreesView的進度。我在IB中創建UIProgressView並只更改顏色。我有屬性和下一個代碼UIProgressView不顯示進度
@property (weak, nonatomic) IBOutlet UIProgressView *progressView;
屬性連接在IB到出口
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"DefaultSS.png"]];
}
- (void) viewDidAppear:(BOOL)animated
{
[self connectToServer];
}
- (void) connectToServer
{
//some code...
sleep(2);
[self.progressView setProgress:0.2 animated:YES];
sleep(1);
[self.progressView setProgress:0.4 animated:YES];
sleep(1);
[self.progressView setProgress:0.7 animated:YES];
sleep(1);
[self.progressView setProgress:1.0 animated:YES];
sleep(1);
//some code...
}
睡眠做工精良,但UIProgressView進度不隨時間而改變。我錯在哪裏?
ohhhh ...我so noooob =(謝謝=) – Neznajka 2013-03-06 19:44:55
......或者他可以使用'[NSThread sleepForTimeInterval:1.f];'它也適用於主線程。 – holex 2013-03-06 21:43:07