1. 程式人生 > >iOS設定背景圖片

iOS設定背景圖片


UIImageView *customBackgournd = [UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.jpg"]];
self.background = customBackground;
[customBackground release];

[self addSubview:background];
[self sendSubViewToBack:background];

2. 

UIImageView *contentView = [UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView setImage:[UIImage imageNamed:@"background.jpg"]];
[contentView setUserInteractionEnabled:YES];
self.view = contentView;
[contentView release];

3. 

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.jpg"]];