I recommend what wheretheidivides suggested, I am using it in my current project for iOS, and it's great. You can even do a couple effects like a burn out effect like in old fighting games, where if the bar subtracts health/energy it leaves a separate bar behind it which slowly reduces its amount until it catches up.