views:

60

answers:

1

I have a class :

@interface UIExView : UIView { ....... }

In another class, UIExView is defined as following: IBOutlet UIExView* exView;

exView is connected to an View in XIB.

I set background image of exView as:

UIColor* bgrColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed: backgroundImageName]]; exView.backgroundColor = bgrColor;

Now I want to change another image as background of exView. I do the same things:

UIColor* newBgrColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed: anotherBackgroundImage]]; exView.backgroundColor = newBgrColor;

It work well on simulator(background image is changed to the new one) but it does not work on real device. Pls, share your experience, thanks.

A: 

Maybe you can try to add an UIImageView in the UIExView, make an IBOutlet to the UIImageView and then make some methods that allows you to change the background image? Just an idea.

Sebastian
Thanks for the comments. I just want to know why the background image doesn't change on real device.