我在錄製應用程序中添加了uiprogreesView。當我點擊開始錄製按鈕時它需要幾秒鐘的時間才能開始錄製,並且我的進度視圖開始,我也用uilabels來獲取錄製的時間。但是我的progess視圖不與記錄time.Actual錄製時間同步是小於進度視圖標籤。這裏是我的代碼UIProgress在錄製應用程序中查看
- (IBAction)startRecordingButtonPressed:(id)sender {
recorder = [[AVAudioRecorder alloc]initWithURL:recordedFile
settings:recordSetting error:&error];
[recorder setDelegate:self];
[recorder prepareToRecord];
[recorder recordForDuration:(NSTimeInterval)60];
[recorder record];
timeStartLabel.text != "0";
progressView.progress = 0.0;
[NSThread detachNewThreadSelector:@selector(startjob)
toTarget:self withObject:nil];
}
- (void)startjob {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
[NSThread sleepForTimeInterval:2];
[self performSelectorOnMainThread:@selector(moreProgress)
withObject:nil waitUntilDone:NO];
[pool release];
}
- (void)moreProgress {
float actual = [progressView progress];
timeStartLabel.text = [NSString stringWithFormat:@"%.2f" ,actual];
if (actual < 1) {
progressView.progress = actual + 0.01;
[NSTimer scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(moreProgress)
userInfo:nil repeats:NO];
}
}
請help.And當我點擊錄音鍵按鈕,然後會去藍色幾秒鐘,然後我背到其默認顏色,然後開始實際記錄,但點擊按鈕時開始進度視圖。
我沒有使用CADisplayLink。你有任何例子或鏈接?除了你建議回答? – iProgrammer 2011-05-23 09:27:46
你可以試試[這個](http://files.slembcke.net/chipmunk/tutorials/SimpleObjectiveChipmunk/)。大多數用途都與openGL相關,但它對於更多基本圖形請求也很有用。 – Guys 2011-05-23 09:36:02