I have this observer and I'm trying to update my UIProgressView in this way:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSProgress *progress = object; NSLog(@"PROG: %f", progress.fractionCompleted); [progressBar setProgress:_progressReceive.fractionCompleted animated:YES];
NSLog displays data:
... 2013-10-29 19:55:26.831 Cleverly[2816:6103] PROG: 0.243300 2013-10-29 19:55:26.835 Cleverly[2816:6103] PROG: 0.243340 2013-10-29 19:55:26.838 Cleverly[2816:6103] PROG: 0.243430 ...
But progressBar is not updated. I notice that if I use NSTimer, it updates:
-(void)progressSend:(NSTimer*)timer{ NSLog(@"Fraction Complete: %@", [NSNumber numberWithDouble:progressSend.fractionCompleted]); [progressBar setProgress:progressSend.fractionCompleted animated:YES]; }
Why is this?
ios
Alessandro
source share