Image.asset causes app size increased - ios

I'm using a launch image for iPad Landscape named "Default-Landscape" which is 5.4 MB in size. My app is an universal app and supported from iOS 5, so I have to assign Launch for "iPad Landscape iOS7" and "iPad Landscape iOS5 and iOS6".
When doing like this, image asset automatically creates separate images for both iOS7 and iOS5,6 named "Default-Landscape" and "Default-Landscape-1". So additional 5.4 MB was added unnecessarily. I know that we can assign Launch images without assets catalog. But I still like to know whether we can assign same image for multiple targets using image asset in Xcode.
Any suggestions please...
Thanks

Related

iPad Pro 3rd Gen Launch Image

We're trying to bring iPad Pro 3Gen support to our app, but to our surprise, there is no slot in the Image Asset Launch Image set to add launch images for iPad Pro 3Gen. Many answers suggest that we use a launch storyboard, but the problem is that we have different images for iPhone X and regular iPhones, and there is no way to differentiate between them using a regular image set, while the Launch Image set cannot be displayed by a UIImageView. Moreover, we cannot add code to the launch storyboard view controller.
Given the conditions:
1. There need to be iPad Pro 3Gen support
2. Images for iPhone Xs and other iPhones need to be different as they currently are in Launch Image asset
How should we approach this issue? I tried to find answers online but they do not seem to help.

#3x images incorrectly used on iPhone 6 or 5S or 5 in XIB's with the "Use as Launch Image" option set

With-in a clean brand new iOS project I've:
added 2 images to the project "background#2x.png" and "background#3x.png"
added a XIB named "LaunchScreen.xib"
checked the XIB's "Use as Launch Screen" option
added a UIView sub-view to LaunchScreen.xib and set its image name to "background.png"
with-in the project settings, under the targets 'General' settings I've set the 'Launch Screen file' to "LaunchScreen"
Now when I launch the app on any of the devices list below the #3x image is displayed in the resulting launch screen when surely the #2x image should be used.
Problem devices (that all use the #3x resource):
iPhone 5 (iOS 8.0.0)
iPhone 6 (iOS 8.0.0)
iPhone 6 (iOS 8.0.2)
iPhone 5 Simulator (iOS 8.0.0)
iPhone 6 Simulator (iOS 8.0.0)
NOTE that the #2x image is distinctive from the #3x image so I can easily identify which one is being used.
At first I assumed this was a bug with the simulator and was staggered when it occurred on a real device also.
I assume this is yet another iOS8 bug however I guess there's also the possibility that its expected behaviour as the result of the launch screen being cached as a static image of some kind.
Any ideas or potential solutions?
EDIT:
For the benefit of others, I have subsequently found that if the images are instead added to an Images.xcassets image set then the correct behaviour is in-fact observed. HOWEVER this is not an ideal solution for us since we have a very specific image export process which means we are not using an Images.xcassets in out project (there are thousands of images in the app).
I have now also raised a Radar with Apple #18513968
http://openradar.appspot.com/18513968
I've just tried this myself, and get the same behaviour you have mentioned.
By setting the Launch Images Source to "Use Asset Catalog", and adding the Launch Image you can get each device to show its specific background. Some screenshots can be seen here:
Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations
Looking into it a bit more, I found a website that mention:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/
"You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class."
Maybe that is the only way to do it.

Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations

What I understood from the available documentation and my testing is that
All existing Apps on iPhone 6 and 6 Plus run in compatibility mode,
which means the APIs (like [UIScreen mainScreen].bounds) will
return 320x568 (iPhone 5/5s) still in new iPhones (6/6 Plus) and
all UI is scaled to the correct resolution by iOS.
To support iPhone 6/6Plus we need to create xib for Launch Screen
(File->New->File->UserInterace->Launch Screen) and set the nib file
as "Launch Screen File".
We can set different images for launch screen inside Launch screen nib file based
on avaialble size classes. [Basically combinations of Any, regular
and compact]
There is no way to differentiate between iPad in portrait and iPad
in Landscape orientation (both are regular width regular height).
Also there no way to differentiate between iPhone 4/4s and iPhone
5/s.
Is there a way I can support iPhone 6/6 Plus mode and also provide different launch images for iPad in portrait and iPad in landscape orientation?
See also the similar problem here iOS 8 size classes for iPad landscape
You donĀ“t have to use the launch screen file to make your App iPhone 6 / 6+ resolution compatible. Instead, you can select the LaunchImage asset as your Launch Images Source.
It can be found at "App Icons and Launch Images" under your Targets:
If there is no LaunchImage asset just go to your Images.xcassets, make a secondary click (right click) and select "New Launch Image":
The result is something like that:
Now just drag and drop your images for the specific resolutions you want to support and set the created LaunchImage asset as your source.
Hope it helps
Cheers
Asset catalogues currently work in landscape mode on iPhone on ios8. I had this reponse from apple support:
"There is a bug involving launch images in asset catalogs and apps
that launch in landscape on iPhone. Behind the scenes, the asset
catalog compiler generates the same UILaunchImages key [1] in the
final Info.plist that you would have added when you were specifying
launch images manually. One of the sub-keys for each launch image
specified under the UILaunchImages key is UILaunchImageOrientation
which is always set to Portrait by the asset catalog compiler. This
makes sense because apps on iPhone always launch in portrait
orientation [2]. However, the iOS app launcher decides that since
your UISupportedInterfaceOrientations only contains
UIInterfaceOrientationLandscapeLeft and
UIInterfaceOrientationLandscapeRight, it will only look for landscape
launch images under the UILaunchImages key, of which it finds none.
Since there is no way to force the assets catalog compiler to specify
Landscape for the UILaunchImageOrientation sub-key of iPhone
launch images, you should continue to specify your launch images by
editing the information property list for your app as before."

Simulator running in scaling mode for iPhone 6 Plus?

My app starts and runs on the new iPhone 6 Plus (or iPhone 6) in the simulator, but elements that I know are supposed to be small on the big screen (i.e. hard coded CGRects) are large, as if the whole app had just been scaled up for the larger screen.
How can I get out of scaling mode in the simulator?
It looks like setting a launch screen file in the "App Icons and Launch Images" section of your project settings, or adding iOS 8 images to your launch image catalog, will enable "native" resolution.
Adding a correctly sized LaunchImage seems to be enough (setting an incorrectly sized image won't).
Also adding the new "Launch Screen File" should work:
You must set correctly sized LaunchImages
For more information about LaunchImages and icons see this documentation
https://developer.apple.com/library/IOs/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
use Asset Catalog Creator from mac app store.
https://itunes.apple.com/gb/app/asset-catalog-creator-app/id809625456?mt=12
give it any image and it will generate all the correct launch images and icons in a xassets file.
This should stop the scaling of the whole app on iphone 6+

iPhone application developed in Xcode 5, not showing icon and launch image while running on iPad

I have developed an iPhone app, it is not universal. Now when i run it on any iPhone it's launching with splash screen and icon image is getting showed on device but-
when I run same app on iPad neither it is showing the launch images/Splash screen nor it's icon image is visible on device.
I am using Xcode 5, Deployment target is 6.0, and app is not universal.
Please have a look of images what i did yet.
what is the correct process in Xcode 5 to set icon images and launch images of any iPhone app, should i set it for iPad somewhere?
Is it because of resolution of images (Icon/Launch) for Retina and Non-Retina Display?
In X-Code 5 image assets is the folder to manage the images including icon images and launch images but in my case to manage it i just check the resolution of every icon image and launch image, some of the images having correct suitable size for retina display but not having proper resolution so i corrected it.
Resolution Non-Retina: 72
Resolution Retina display: 376
In image assets > icon folder > it worked for me when i put images with correct resolution and size i.e.-
Xcode 5 is smart enough to check the resolution so be sure about the resolution of images, I Think.
When i tried to add correct images in image assets > launch image, it didn't work yet so For launch image i used the old pattern to handle Launching image like-
It worked in my case, Hope It will help others as well.
I think you need tick the required device and need to add App Icons and Splash Screens using image assets like.
Here are the sizes required for according to devices.
Please review:
Remove app from simulator (Reset simulator), clean project.
then check app icons and images in assets according to iOS targets and check if warning coming. then build and run the app And if stay remains please review

Resources