iOS: Preparing background images for applications

前端 未结 7 965
执笔经年
执笔经年 2020-12-23 14:51

Mostly every iOS application has a view with an image as background. Is there any image sizing guide out there? For example here is an iOS screen designed in Sketch:

7条回答
  •  温柔的废话
    2020-12-23 15:12

    If you still have the same problem then you can try this one. For this you have to add only one image with good resolution and below code..

    UIImage *bgImage = [UIImage imageNamed:@"art_background_star@3x.jpg"];
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    UIGraphicsBeginImageContextWithOptions(screenSize, NO, 0.f);
    [bgImage drawInRect:CGRectMake(0.f, 0.f, screenSize.width, screenSize.height)];
    UIImage * resultImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIColor *backgroundColor = [UIColor colorWithPatternImage:resultImage];
    self.view.backgroundColor = backgroundColor;
    

提交回复
热议问题