1

In my application I have xib launch screen. It has background image displayed in UIImage. Before iPhone X I had images of one size - it easily scaled to all iPhone screen sizes from 4.0 up to 5.5 without problems due to the same aspect ratio.

For iPhone X I created image with different size and aspect ratio. Now how should I specify what image to use as background exactly on iPhone X? I don't see any way to do it with traits and "launch screens may not set custom class names" where I could conditionally switch image. Just resizing original image is not an option since it breaks proportions.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Fyodor Volchyok
  • 5,610
  • 4
  • 28
  • 45
  • 1
    Only idea that comes to my mind is to try to play with the size classes and devices in the attributes inspector of the image set in the assets. Did you try that? – Milan Nosáľ Oct 11 '17 at 11:52
  • 1
    Typically you would use either aspect fit or aspect fill and accept the fact that there will be some image outside the viewable area or some blank space padding the image – Paulw11 Oct 11 '17 at 12:02
  • @MilanNosáľ yes, and I said that (read about trait variations). as I can see iPhone 10 has the same size class as other iPhones (https://developer.apple.com/ios/human-interface-guidelines/visual-design/adaptivity-and-layout/ scroll to Device Size Classes) making it impossible to distinguish which device is iPhone 10 – Fyodor Volchyok Oct 11 '17 at 12:19
  • @Paulw11 good point, though it doesn't answer the question. If nothing else could be done I would use your solution. – Fyodor Volchyok Oct 11 '17 at 12:22
  • @Krunal what exactly you are interested in? a picture? it's just a repetitive pattern, but question is agnostic about such detail. As for project - you could just create an empty view controller, add image view constrained to root view's edges and try to set one image for all iphones and another image for iPhone 10 with only Interface builder (without any code). You should be in exactly same environment as me. – Fyodor Volchyok Oct 11 '17 at 14:26
  • @FyodorVolchyok. Fair enough, but unfortunately the answer to your question is that you can’t distinguish a particular model, such as the iPhone X, in the launch screen. As you have noted there are no specific traits for that device. – Paulw11 Oct 11 '17 at 18:56
  • @Paulw11 my question doesn't says that it has to be answered only with traits. I mentioned traits specifically to list what I've tried so we can avoid conversation like this :) What I'm looking for is approach that could be different. In particular I hope this problem is already solved by xcode team and I just need to tick the required checkbox somewhere. They often provide solutions in their wwdc videos, but I haven't seen anything related so far. – Fyodor Volchyok Oct 11 '17 at 19:11
  • Let me clarify my comment: You can’t select an iPhone X specific image in your launch storyboard through any method. – Paulw11 Oct 11 '17 at 19:22

0 Answers0