views:

251

answers:

2

Hi all! How can I insert into my UIViewController an image from the resources as background image? thanks in advance!

+1  A: 

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.

TechZen
+1  A: 

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];
}
luvieere