2011-11-18 49 views

回答

2

這很簡單:

yourSubView.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"BackgroundImage.png"]]; 
0

類別:

@interface abc : UIView { 
....... 
} 

在類定義子視圖:子視圖的

IBOutlet UIView* subView; 

設置的背景圖像作爲:

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

最後補充子視圖的視圖

[self.view addSubView:subView];