UIViewController with background image

后端 未结 2 2139
深忆病人
深忆病人 2020-12-18 05:27

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

2条回答
  •  盖世英雄少女心
    2020-12-18 06:24

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

提交回复
热议问题