UIViewController with background image
How can I insert into my UIViewController an image from the resources as background image? tha开发者_开发问答nks in advance!
Add it UIViewController
's view, somewhat like this:
- (void) viewDidLoad
{
UIImage *background = [UIImage imageNamed: @"background.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: background];
[self.view addSubview: imageView];
[imageView release];
[super viewDidLoad];
}
UIViewControllers don't have background images. Only views themselves have visual attributes.
UIView does not have a background image property. To display a background image, you usually simply put a UIImageView displaying the image in the view hierarchy so that it appears visually behind all other views. This can be done programmatically or in Interface Builder.
精彩评论