How do you make a background image scale to screen size in swift?

前端 未结 9 2128
刺人心
刺人心 2020-11-27 04:27

I\'m trying to make a UIView image for my background in swift using pattern image. The code I have works well except for the fact that I want the image to take the whole scr

9条回答
  •  星月不相逢
    2020-11-27 05:16

    `

    CGRect screenRect = [[UIScreen mainScreen] bounds];
    
    CGFloat screenWidth = screenRect.size.width;
    
    CGFloat screenHeight = screenRect.size.height;
    
    _imgBackGround.frame = CGRectMake(0, 0, screenWidth, screenHeight);` 
    

提交回复
热议问题