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

来源:互联网 发布:怎样设计淘宝店铺logo 编辑:程序博客网 时间:2024/04/30 10:31
- (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];
}
0 0
原创粉丝点击