开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜