Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mpemburn

macrumors member
Original poster
Jan 11, 2008
51
0
Bel Air, MD USA
Hi,

I've added an NSProgressIndicator to the splash screen of my app (since it can take a while to locate the resources necessary to load the main window). I wanted to have a "Bar" type indicator but nothing I've been able to do will make it move as it should. When I change it to the "Spinning" type, it works just fine but the Bar just sits there.

The indicator is connected to the app controller via:

Code:
IBOutlet NSProgressIndicator * splashProgress;

. . . and this is the code that runs it:

Code:
[splashProgress setHidden: NO];
[splashProgress startAnimation: self];

Any ideas?

-- Mark
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I'd double-check your IB connections. Make sure you're calling the code after/during awakeFromNib (e.g. make sure your progress is non-nil). etc..
 

mpemburn

macrumors member
Original poster
Jan 11, 2008
51
0
Bel Air, MD USA
I'd double-check your IB connections. Make sure you're calling the code after/during awakeFromNib (e.g. make sure your progress is non-nil). etc..

The IB connections are definitely there and working and the code that calls loads the splash screen (including the calls to the progress indicator) is right at the top of awakeFromNib. In order to prove that the connection is valid, I've comment out the "startAnimation" line, and see a stopped spinner when the screen loads. When I un-comment it again, the spinner animates. If I add the line:

Code:
[splashProgress setStyle: NSProgressIndicatorBarStyle];

. . . it'll change to the bar style but not move.

-- Mark
 

rossipoo

macrumors regular
Jun 7, 2009
109
0
If you want it to show the progress, indeterminate should be off. Indeterminate means that it does NOT show the amount of progress, but only that the application is "busy".

Are you updating the progress value with setDoubleValue regularly throughout your loading process?
 

mpemburn

macrumors member
Original poster
Jan 11, 2008
51
0
Bel Air, MD USA
In this case, I don't really have any progress to show -- it's waiting for a dylib to recognize all imaging devices attached to the system -- so "indeterminate" is the appropriate mode. Like I have said, the Spinner works in indeterminate mode and the Bar does not.

Think I'll try a dummy project to see if the problem is universal or some quirk in this app. I've had some other annoying phenomena, such as controls that stop appearing after I make some unrelated change to the panel. I would just hate it if there's something wrong with the NIB -- I've put a lot of time into this interface.

-- Mark
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
The only other thing I can think of is the progress bar is somehow being blocked from animating, but I believe on 10.5+ the default is setUsesThreadedAnimation:YES so that shouldn't be a problem even if you're blocking the main thread. I would agree on the dummy project because I think either something is borked with your project or you're just forgetting to do something small.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
I've had problems with NSProgress indicators if I didn't do the work in another thread so that is probably the best way forward.
 

mpemburn

macrumors member
Original poster
Jan 11, 2008
51
0
Bel Air, MD USA
Figured out an acceptable workaround -- set the values to: Minimum = 0.0, Maximum = 100.0 and Current = 99.0. As long a the bar is reasonably short, there's no visible difference between being 99% done and 100% done so the bar shows motion across its full length.

-- Mark
 

consoleart

macrumors newbie
Sep 23, 2014
3
0
Wow, spent 1/2 hr putting my code in the INIT and wondering why it was not working.

Moving it to AWAKEFromNib made it to work. Thanks for the tip
-(void)awakeFromNib{

[progressIndicator setHidden:NO];
[progressIndicator setIndeterminate:YES];
[progressIndicator setUsesThreadedAnimation:YES];
[progressIndicator startAnimation:nil];

}
 

mfram

Contributor
Jan 23, 2010
1,307
343
San Diego, CA USA
Yeah, awakeFromNib is called after all the Outlet connections are set up. If the code is in init then those connections aren't set up yet and your calls would be no-ops.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.