views:

31

answers:

1

I'm designing a progress bar for an app that essentially is two UIImages - both are the exact same size (long rectangles with rounded corners), except they are colored differently.

The bottom bar is black and the progress bar that will fill over it is grey. Displaying the bottom bar is easy enough. The issue I'm trying to figure out is how to get the grey bar to display only a piece of itself.

For example....

grey : <-------

white: <------------------->

Essentially, I'd like to display only the first half of the grey bar because my progress is at 50%. I'd like to keep the rounded corners at the left of the image though.

Is it possible to dynamically crop UIImages?

+1  A: 

The easiest way to do that is to create using 3 separated images: 2 with rounded corners (left and right), and one small easily resizable image to display progress. And yes, you can crop images dynamically, but not as easy and as quick as need for progress bar.

eviltrue