Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 24, 2009, 09:21 PM   #1
mpemburn
macrumors member
 
Join Date: Jan 2008
Location: Bel Air, MD USA
Problem with a NSProgressIndicator

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
mpemburn is offline   0 Reply With Quote
Old Jun 24, 2009, 09:23 PM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
Are you sure the indeterminate checkbox is on in IB?
kainjow is offline   0 Reply With Quote
Old Jun 24, 2009, 09:32 PM   #3
mpemburn
Thread Starter
macrumors member
 
Join Date: Jan 2008
Location: Bel Air, MD USA
Wow -- that was fast! Yes, it's checked.

-- Mark
mpemburn is offline   0 Reply With Quote
Old Jun 24, 2009, 09:46 PM   #4
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
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..
kainjow is offline   0 Reply With Quote
Old Jun 24, 2009, 10:11 PM   #5
mpemburn
Thread Starter
macrumors member
 
Join Date: Jan 2008
Location: Bel Air, MD USA
Quote:
Originally Posted by kainjow View Post
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
mpemburn is offline   0 Reply With Quote
Old Jun 24, 2009, 11:28 PM   #6
rossipoo
macrumors regular
 
Join Date: Jun 2009
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?
rossipoo is offline   0 Reply With Quote
Old Jun 25, 2009, 06:50 AM   #7
mpemburn
Thread Starter
macrumors member
 
Join Date: Jan 2008
Location: 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
mpemburn is offline   0 Reply With Quote
Old Jun 25, 2009, 09:13 AM   #8
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
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.
kainjow is offline   0 Reply With Quote
Old Jun 25, 2009, 03:40 PM   #9
Eraserhead
macrumors G4
 
Eraserhead's Avatar
 
Join Date: Nov 2005
Location: 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.
Eraserhead is offline   0 Reply With Quote
Old Jul 12, 2009, 09:28 AM   #10
mpemburn
Thread Starter
macrumors member
 
Join Date: Jan 2008
Location: 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
mpemburn is offline   0 Reply With Quote
Old Sep 24, 2014, 01:01 AM   #11
consoleart
macrumors newbie
 
Join Date: Sep 2014
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];

}
consoleart is offline   0 Reply With Quote
Old Sep 24, 2014, 08:20 PM   #12
mfram
macrumors 6502a
 
Join Date: Jan 2010
Location: 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.
mfram is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
GoodPlayer Problem - Never mind. Problem solved. BasicGreatGuy iPad Apps 0 Mar 14, 2014 02:18 PM
iTunes DRM problem? Or, HD Versions of Movie on ATV1 Problem? Aqueous Apple TV and Home Theater 5 Feb 9, 2014 08:54 AM
NSProgressIndicator Flickers on scroll of below WebView - Really weird behaviour gwelmarten Mac Programming 0 Dec 12, 2013 11:53 AM
iPhone: Gmail App problem or Jailbreak Problem? ARSkemp Jailbreaks and iOS Hacks 6 Apr 10, 2013 12:43 AM

Forum Jump

All times are GMT -5. The time now is 10:47 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC