2010-07-01 82 views
0

的背景圖像I有一個類:更改的UIView

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

在另一類,UIExView被定義爲以下:

IBOutlet UIExView* exView; 

EXVIEW被連接到一個XIB視圖。

我設置低照度的背景圖像:

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

現在,我要換另一個圖像作爲超高感度的背景。我做同樣的事情:

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

它很好的模擬運行(背景圖像更改爲新的一個),但它並不真實設備的工作。請分享您的經驗,謝謝。

回答

0

也許您可以嘗試在UIExView中添加UIImageView,將IBOutlet製作爲UIImageView,然後製作一些允許您更改背景圖像的方法?只是一個想法。

+0

感謝您的意見。我只是想知道爲什麼背景圖像不會在真實設備上發生變化。 – user381563 2010-07-02 13:38:50