I'm trying to update a UIProgressview while loading data from a server. I have a Class with a sharedInstance to handle the server communication and there is a method which gets data from the server (in a while loop). Now I would like to update my UIProgressView by sending notifications from my server-communication-Class (sharedInstance), and it simply doesn't work.
The UIProgressView is correctly set in InterfaceBuilder and show/hide/setProgress works fine, but setProgress doesn't work through notification.
Here is the test-loop in my server-communication-Class:
- (void)completeServerQueue {
NSNumber *progress = [[NSNumber alloc] init];
for (int i=0; i<15; i++) {
progress = [[NSNumber alloc] initWithFloat:(100/15*i) ];
float test = [progress floatValue];
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ServerQueueProgress"
object:progress];
sleep(1);
}
}
And this is the Method called when the notification is detected (I checked it with breakpoints, it is executed...):
- (void)serverQueueProgress:(NSNotification *)notification {
[serverQueueProgressView setProgress:[[notification object] floatValue]];
}
Any ideas?