给一个控制器的view设置背景图片

- (void)backGroundImage
{
    UIImage *oldImage = [UIImage imageNamed:@"test"];
    
    UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0.0);
    [oldImage drawInRect:self.view.bounds];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    self.view.backgroundColor = [UIColor colorWithPatternImage:newImage];
}

你可能感兴趣的:(给一个控制器的view设置背景图片)