tags:

views:

27

answers:

1

Hi, I have a label I have added a background to like this:

myLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"some image"]];

The user will enter text into the label and when finished, I would like to have the background image fade away but have the text remain. I've tried UIView Animations but UIImage does not inherit from UIView so that method has not worked and I am a bit stuck. Either I need to add a background image to my label differently or animate in a different way to get the fade out. Any thoughts would be appreciated.

A: 

Why not just use a UIView where you add both another UIView with your background, and a UILabel on top, like so?

UIView

  • UIView
  • UILabel (with [UIColor clearColor] as backgroundColor)

Then you can fade out the second UIView, and the UILabel will remain visible.as backgroundColor)

Joseph Tura
Thanks for the response. I ended up using a UIImageView on the label and fading that out.
Jim Smith
Glad you figured it out...
Joseph Tura