Reputation: 315
I've been trying to use the new NSProgress class to report the progress of an operation in my Mac app. Right now, it's saved as a property in my App Delegate (and is updated from a different class and a different queue), and seems to be updated correctly, as proven by logging [_currentProgress fractionCompleted]
.
However, my issues come when I try to update a progress bar using the NSProgress object. I've got the progress bar set up with bindings something like this:
The progress bar seems to stay on whatever my null placeholder is (as proven by changing the null placeholder to '1'), not redrawing or updating to accommodate any further progress. currentProgress
is only set once an operation has started, which will be why the progress bar uses the null placeholder at first, but it makes no effort to update the progress bar when an NSProgress object is set to that property.
It'd be great if somebody could help me out here… (There must be something stupid I'm doing wrong!)
Upvotes: 3
Views: 2608
Reputation: 8245
I think the problem is that you cannot use bindings for fractionCompleted
if the used NSProgress is being updated on a background queue. I am implementing this combo myself right now and I don't get a bar to appear via normal bindings like you. If I spect to KVO-observing it and setting the bar's doubleValue it works... as long I dispatch that onto the main queue.
Upvotes: 0
Reputation: 117
Unless you say otherwise I am going to assume you are using an indeterminate progress bar.
Cocoa NSProgressIndicator can be indeterminate, in which case it is a barber shop style swirly that is either moving or not:
Or, they can be determinate, in which case it is a typical left to right wipe progress bar:
Try unchecking indeterminate and seeing if your progress shows up using this settings:
Upvotes: 0