首页 > ios 设置完背景图片,但是背景图片不可以完全显示?

ios 设置完背景图片,但是背景图片不可以完全显示?

   UIImage* bgImg = [UIImage imageNamed:@"login_bg.png"];
   self.view.backgroundColor = [UIColor colorWithPatternImage:bgImg];

尝试:

[self.view addSubview:[UIImageView alloc] initWithImage:bjImg]]


UIImage 是不能设置缩放的,你的图多大就是显示多大。 比如你的图示1000*1200的那么肯定是超出了屏幕, 而UIImageView是可以设置缩放。

我一般是把UIimage 放在UIimageView上面。

UIImageView *aa = [[UIImageView alloc]initWithFrame:self.view.frame];
aa.image = [UIImage imageNamed:@"1"];
【热门文章】
【热门文章】