My design team has given me various launch screen images for all types of screen sizes found here.
I want to support iPhone 6+ and iPad Pro so I know launch screen files should be used instead of image assets.
However, how do I specify in my launch screen file the different images for each screen size? I thought size-classes would be the way to go but I can't differentiate between iPad Air 2 and iPad Pro that way.
There's also no iPad Pro image asset either.
You can look at device specific image assets (on the attributes inspector of an image in an asset bundle).
It may be impossible to match the design exactly because you can't run code at this point. It may be easier to explain this to the designers and have them design to the constraint.
One simple idea is to have a centered image at the correct resolution and to use a view underneath to have a background (color or tiled image).
Related
I'm trying to create an new asset catalog for universal project (iPhone and iPad). I add new xcassest:
But As you can see in case of iPhone only shows one option for 2x. In my case I need to add backgrounds and for both 4-4s and 5-5s phones the images are 2x also is not showing an option for the 6/7 and is also 2x.
My question to guys is how can add the assets for every screen size in my xcassest file.
I'll really appreciate your help.
Nothing is "missing". Screens can come in different resolutions, and all possibilities appear in the screen shot. So every image in your app will come in three versions, and slots are provided for all of them. (You should use "Universal" unless the images for iPhone and iPad are truly different from one another, i.e. different content.)
As for image size, just use a size that works with the largest screen and permit the image view to scale it down as needed (or, for less memory waste, scale it down in code yourself at runtime).
I created an universal iOS app. On all iPhone variants I want native resolution without scaling, so I created splash screen images for all available sizes in images.xcassets/LaunchImage.launchimage and set them all in Xcode:
Now, this works very well for all iPhone versions up to the biggest iPhone 6 Plus.
On iPad (with high pixel density) though I don't want native resolution. Instead I want it to scale the app (even if it looks a bit blurry then, but that's ok).
How would I do that?
In image assets you have to provide proper size for each launch screen, You can not use the same image for two devices in launch-images ( unless you have two copies of the same image ).
If you want to make app-size smaller, implement launch screen, set its background color to your desired background color and put your logo in the center of it. You can now remove iPhone 6,6Plus images from image assets, but you still have to provide launch images for iOS 7 devices (old iPhones / iPad ).
Don't use the Asset Catalogue. Create a LaunchScreen.xib , add a UIImage inside the view. Open the attribute inspector in the right hand panel and set the view mode to Aspect Fill.
The solution was quite easy, I simply changed project type from "universal" to "iphone" and that did the trick!
Here is my situation: I have a simple app with some buttons that are images. I have the image set in xcode using the menu on the right (i simply click the button and pick the image I want from the dropdown). I created them using a simple image program so they look somewhat glossy and nice, but nothing crazy. I also sized them for an iphone screen.
Using some auto layout, I've been able to ensure the layout stays the same and the buttons change size with the size of the iphone. I would like this to be the case with the iPad as well, but I'm worried if they size too big, I'll lose image quality with the button images. I'm very new to layout and coding and have only been doing this development stuff for a little while. What are my options? I figure they are...(and these might not even be possible, throwing them out there):
1) Create two version of the app, one only for iPad and one only for iPhone with different size/quality images for each.
2) Code swift to identify the device and assign the different image accordingly
3) Pick a resolution for the iphone image that when expanded on iPad won't lose much quality
4) I'm overreacting and this isn't a big deal whatsoever since it's just a basic glossy button with some shadowing.
Thank you! Advice/links appreciated.
The better option to add images for both iPhone(retina/non-retina) and iPad(retina/non-retina). Put the high-resolution and original versions of your image in the same location in your application bundle.
Ones you added images same as the below naming format in to your application resources, the application will automatically pick the right one for you.
MyImage.png - Default version of an image resource.
MyImage#2x.png - High-resolution version of an image resource for devices with Retina displays.
MyImage~iphone.png - Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays.
MyImage~ipad.png - Version of an image for iPad.
MyImage#2x~ipad.png - High-resolution version of an image for iPad devices with Retina displays.
This has been an amazingly exasperating and non-transparent process.
So far, from this question I have figured out the different dimensions of launch images I needed and that I can safely not use launch xibs / storyboards if I already have the launch images, and from various posts I have determined that the naming convention (APPARENTLY??) should be Default#2x.png for iPhone 4s, Default-568h#2x.png for iPhone 5, Default-667h#2x.png for iPhone 6, and Default-Portrait#3x.png for iPhone 6+, although I have seen conflicting information on this so I'm not even sure....do I need ~iphone appended to the names?
BUT THEN, I go to add them to xcode so I go to my images.xcassets thing and select "new launch image" and this chart thing appears that makes zero sense to me....it only has space for one landscape picture, "Retina HD 5.5", but not for the other landscapes....even though the project is supposed to be portrait-only anyway...and if this thing is keeping track of my images then what do I need the naming convention for? This is so confusing.
Okay, the easiest way to make a nice launch image is to use a xib. You won't have to worry about naming conventions and it will scale beautifully across all your devices.
Step 1:
Your project should come with a file called LaunchScreen.xib. If you don't see one like that, hit File > new File > User Interface > Launch Image.
Step 2:
Open the xib and click on edge of the xib. Then, click on the Attributes inspector. Set the size to whatever you are using in the rest of your app. We are taking advantage of the auto layout and so the image should be resized to fit other devices.
Step 3:
Drag in an image view and resize it to fill the xib. Insert a high resolution version of your splash screen.
In my application, I am having trouble showing iPad Retina images. I know I have to use the #2x~ipad.png extension in order to get them to properly show and I do that. My images are named according so they are all named the same besides the extension for each device. However, my images appear blurry when viewing them on an iPad 3. I know the images are the proper size and PPI but it just doesn't look clear.
My images are in my 'Copy Bundle Resources' too. I have tried to clean my project, and restart Xcode. No luck.
Also in Interace Builder in my iPad XIB, I have each image set to the -72.png image (I guess the image automatically switches to the #2x~ipad.png if it is an iPad 3 correct?)
Is there any way to confirm maybe via NSLogs to see if it is loading the correct images? Also is there anything else I should double check to ensure that the proper images are loaded.
Uh, if you really are doing this:
[name]-72.png and [name]#2x~ipad.png
thats not right.
If this is a universal app, then you have
Foo.png (or Foo~iphone.png) and Foo#2x.png (or Foo#2x~iphone.png) [NOTE: iphone not iPhone];
Foo~ipad.png and Foo#2x~ipad.png
This all working for me in my universal app.
EDIT: you can read about the naming convention in Apple's "Resource Programming Guide", page 46:
The bundle- and image-loading routines automatically look for image
files with the #2x string when the underlying device has a
high-resolution screen. If you combine the #2x string with other
modifiers, the #2x string should come before any device modifiers but
after all other modifiers, such as launch orientation or URL scheme
modifiers. For example:
MyImage.png - Default version of an image
resource.
MyImage#2x.png - High-resolution version of an image
resource for devices with Retina displays.
MyImage~iphone.png -
Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png -
High-resolution version of an image for iPhone and iPod touch devices
with Retina displays.
EDIT2: So I did trip on a reference to "-72" (and -50). These were used in iOS 3.1.3 and older. The full explanation is found "iOS Application Programming Guide", "App Icon" section (links too fragile to use).
What I am doing is setting the image names to:
[name]_ipad.png, [name]_ipad#2x.png. [iPad]
[name]_ipod.png, [name]_ipod#2x.png. [iPhone]
And, I added a category on UIImage, mc_imageNamed: that appends the _ipad or _ipod based on the current device. And of course I have set the images based on their names in the XIBs.
This method is guaranteed to work, from my experience. It would be great if someone would fix your issue, but this solution is also available.