I have a meter as shown in the figure. I can able to move the needle across the meter, no problem with that. The problem is, I need to change the color codes in the meter dynamically according to the user input.
I am getting three values from the user. If the first value is 30, I need to set green color in the range 0 to 30. If the second value is 70, I need to set yellow color till the range 70. Similarly for the third value, I need to set the maximum value and the set the red color.

Changing the color code of a view is not a big deal. But, I have no idea how to dynamically set the colors in a particular range(irregular shape).
Edited: Currently I am just moving the needle across the meter (Moving an imageview inside a normal UIView). Expected output should be like the image attached and I had not set any colors now.
Help me to proceed. Thanks in advance..!
I guess the most simplest way, would be –
Add 3 separate UIView layers to parent UIView layer.
all these 3 subview layers will have different colors – which can be dynamically changed.
These subviews, are just plain rectangles.
Now – this is where the fun begins:
You must rotate and position each subview separately – accordingly how it should be.
It also can be done dynamically, but it will be a bit harder.
Just follow these tutorials to rotate UIView:
http://iphonedevsdk.com/forum/iphone-sdk-development/4181-rotating-an-uiimageview-around-an-arbitrary-point.html
Rotate a UIImageView around a point off screen? (center of uiImageView
rotate UIView/UITableView around a point
How to rotate view around anchor point multiple times
And at the end – mask parent UIView, so that all subviews would be trimmed and appeared as irregular shapes.
Here is a tutorial how to do it:
How to mask an image in IOS sdk?
Good luck!