开发者

UIViewController with background image

开发者 https://www.devze.com 2023-01-02 08:49 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消