I am adding uiprogreesView in recording app.When I tap start recording button It will take few seconds to start recording and my progress view starts ,I also manged uilabels to get the recorded time.But my progess view is not synchronized with recording time.Actual recording time is less then progress view label.. Here is my code
- (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];
}
}
please help.And when I tap record button then button will go blue for few seconds and then I backs to its default color, then actual recording started but progress view started when button tapped.