Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacMan988

macrumors 6502a
Original poster
Jul 7, 2012
833
116
Hi,

I have launch images designed for my app for various screen sizes. But I figured it out that Apple now recommends to use an XIB or a Storyboard file as the launch image. Is it possible to place a UIImageView in the XIB and load the correct image (with correct resolution for the device) in the UIImageView?
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Yes, this is new with iOS 8. You can use a launch xib or launch storyboard. You specify this in the Launch Screen File setting in Xcode under Target > App Icons and Launch Images. If you support older OS versions you still need the launch images for those as before.

@OP, there can be no code associated with the xib. I haven't done this for an image but I don't see why you can't have an image view in your xib and specify the image name to be an image from your bundle. Did you try that?

I don't think you can adjust the image name from the app code but you should be able to specify a single image name in the xib.

If your goal is to load the launch images that were used for iOS 7 into an image view that wouldn't make sense. Make your xib look like the first screen of your app. That's the point of it. It will adjust to the screen size and orientation of the device and look correct.

I needed a table view with navbar. Doing this with a storyboard worked better than with a xib.
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,871
228
Novi, MI
I don't think you can adjust the image name from the app code but you should be able to specify a single image name in the xib.

Yes, you can do this. I have done this with multiple applications. Include the image in your Images.xcassets (or whatever yours is named) and specify this image in Interface Builder
 

Mascots

macrumors 68000
Sep 5, 2009
1,665
1,415
If your goal is to load the launch images that were used for iOS 7 into an image view that wouldn't make sense. Make your xib look like the first screen of your app. That's the point of it. It will adjust to the screen size and orientation of the device and look correct.

I needed a table view with navbar. Doing this with a storyboard worked better than with a xib.

This. I was going to say exactly what you said in your last line, but it's important to emphasize for others: Use a Storyboard, not a Nib, for your Launch Image if you want to correctly compensate for UINavigationBar's and Status Bars.
 

MacMan988

macrumors 6502a
Original poster
Jul 7, 2012
833
116
Thanks for all replies.

Yes, you can do this. I have done this with multiple applications. Include the image in your Images.xcassets (or whatever yours is named) and specify this image in Interface Builder

I know that the Images.xcassets can be used to load the correct image based on the pixel density of the device. Is there any similar way to load versions of images based on resolution as well? (e.g: I have two background images for the iPhone 4S and iPhone 5 with two different resolutions and I want to load the correct one based on the device type).
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,871
228
Novi, MI
Thanks for all replies.



I know that the Images.xcassets can be used to load the correct image based on the pixel density of the device. Is there any similar way to load versions of images based on resolution as well? (e.g: I have two background images for the iPhone 4S and iPhone 5 with two different resolutions and I want to load the correct one based on the device type).

When you have an image set you can specify different images based on the specific device size. Just set the "Devices" drop down to "Device Specific"

See here:
IN9Qp70.png
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.