2

I have an app which has image asset with 3 size images @1, @2, @3 as a background image.

I implement launch screen into my project to make app seen as fullscreen on iPhone X. As you know, launch screen asset has size for iPhone X so launch screen looks okay. However, my background image doesn't look good because @3s' aspect ratio is for plus devices not iPhone X.

Where should I add a proper size image?

EDIT: My question is not about launch screen Image. It is about an background image that I use on regular ViewController

Mr Some Dev.
  • 315
  • 4
  • 19
  • Please take a screenshot when splash screen appears while app launch and attach here in question for better idea what's happening. – Kiran Jasvanee Nov 30 '17 at 07:13
  • Sorry I can't share screenshot because It is a project from my company which is forbidden :( Btw Why do you need splash screen? I have problem with background image not splash screen – Mr Some Dev. Nov 30 '17 at 07:35

2 Answers2

1

It is not a best approach but I solve it by creating another image asset and put iPhone X background image to its @3 area. Then In code I check If It is iPhone X screen, If yes I use image asset with x background, If other use default image asset.

    - (void) setBackgroundImage{
    // Load launch image
    NSString *launchImageName;
    if ([UIScreen mainScreen].bounds.size.height == 812){
        launchImageName = @"PublicBackground_X"; // iPhone X
    }
    else {
        launchImageName = @"PublicBackground"; // Other iPhones
    }

    UIImage *image = [UIImage imageNamed:launchImageName];
    [self.backgroundImage setImage: image];
}

EDIT: I don't know why I get bad reputation. None of other solutions worked for me. Clipping an Image shouldn't be acceptable If u have right resolution

Mr Some Dev.
  • 315
  • 4
  • 19
1

Rather than use an image as your launch screen, you should try using a launch storyboard.

This could contain a single view controller that contains a UIImageView, with contentMode = .aspectFill. This will clip some of the image on either side, but this might be acceptable to you.

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
  • 1
    Sorry If I wasn't clear but my question is about a background Image which I use on regular ViewController. I'm already using LaunchImage as splash. – Mr Some Dev. Jan 15 '18 at 11:36