My ProgressView doesn't update the progress.
I Did this by Interface Builder.
My ProgressView is in a tableViewCell
.
//Declared in TableViewCell
@property(nonatomic,retain) IBOutlet UIProgressView *progressview;
and also Synthesized in Cell implementation.
then imported in my viewController
//Declared AVAudioPlayer
AVAudioPlayer *player;
in cellForRowAtIndexpath
method :
obj.progressview.progress = 0.0;
in didSelectRowAtIndexPath
method :
NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(methodToUpdateProgress) userInfo:nil repeats:YES];
m_timer = [NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(updateTime:)
userInfo:nil
repeats:YES];
For every 1 second my methodToUpdateProgress is Called
-(void)methodToUpdateProgress{
dispatch_async(dispatch_get_main_queue(), ^{
[obj.progressview setProgress:(float)(player.currentTime/player.duration) animated:YES];
NSLog(@"method");
});
}
I have a button with 2 actions Play and Pause. Those 2 actions works completely fine.
If I click on a Row in tableview
, corresponding song plays, timer starts and for every 1 sec it called my methodToUpdateProgress,but my ProgressView doesn't show any progress.
Help me what should I do ?