views:

568

answers:

1

Hi,

I need some inspiration on how to build a nice progress bar for the iPhone. What I want to build is a custom progress bar, as I've drawn here:

alt text

My approach up to now is to use a PNG (gray in the figure above) with a transparent rounded rectangle. Through this rectangle, users see the moving bar. It would be nice to draw this bar with Quartz and give it a fancy animation (similar to the Mac OS X progress bars).

Any hints how to do this

+1  A: 

you could use a couple nested UIViews and control the size of the childview and have different colors of backgrounds to show the progress or you could subclass the UIProgress bar like this example of the slide to unlock UISlider that has animation. The example is of a UISlider but the method used for animation could also be used on a progress bar without the difficulty of handling touches.

here is a link directly to the code from that discussion

AtomRiot
Nice sample project. Thank you :-)
Stefan
oh, and in OS 4.0 make sure you assign some image to the max and min track images if you are not already or it will use the default blue and white ones. you can get them clear like this, if clear.png is a small transparent pngUIImage *clearImage = [UIImage imageNamed:@"clear.png"];clearImage=[clearImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];[slider setMinimumTrackImage:clearImage forState:UIControlStateNormal];[slider setMaximumTrackImage:clearImage forState:UIControlStateNormal];
AtomRiot