PhoneGap iPad lauch screen does not fit - iphone

I created an App which is compatible to iPhone and iPad. Because it is based on HTML (PhoneGap) the App itself is the same for both devices (HTML scales well!). But the launch screen image does not fill out the display on the iPad upon launch.
In my Resorces folder there is only the iPhone launch image which is to small for the iPad, how can I add an other one for the iPad?

You need to specify the launch image file (UILaunchImageFile) property in your application's info.plist:
For example, if you set the value for the key UILaunchImageFile~ipad to iPad, your file names should be iPad-Portrait.png and iPad-Landscape.png. You could similarly change it for the iPhone, or use the default (Default.png) for iPhone.
This is defined in Information Property List Files.

Hey, I've found a solution to this issue, using phonegap 1.9 dropping this code into your apps delegate should do the trick:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIImage* image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"Default-Portrait" ofType:#"png"]];
imageView = [[UIImageView alloc] initWithImage:image];
[image release];
imageView.tag = 1;
[window addSubview:imageView];
[imageView release];
}
That needs to go in the 'applicationDidFinishLaunching' function after the [ super applicationDidFinishLaunching:application ] call.

You need to specify the launch image as mentioned above, but also check to make sure that after the build your launch icons are in the right place. After doing a Build/Run of a PhoneGap project, check the Resources folder in xcode. I found that my additional launch screens and app icons hadn't been moved there in build. Once I copied them in manually and re-built, all the icons and launch screens worked as they should for ipad and iphone.

I had the same problem. I tried a whole bunch of solutions, which were proposed here and on the net. Nothing worked. My Problem was that I'm using a deployment target < iOS 3.2 which does not support the Info.plist settings Mo. described in his post.
Unfortunately Apple has several documentations on the Info.plist / splash screen matter. This one helped:
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW18
You set up your project like this:
Make no "Launch image" settings in Info.plist. Just add the following images:
Default.png --> This is the (big) iPad splash image
Default-Landscape.png --> This is the (big landscape) iPad splash image
Default-Portrait.png --> This is the (big portrait) iPad splash image
Default~iphone.png --> This is the (small) iPhone splash image
To support high-resolution displays:
Default#2x~iphone.png --> --> This is the (retina) iPhone splash image

you need to put a file called "Default.png" in your resources - splash folder. This will remove it, yes i know it sounds silly, because it's an IPAD app, but if you don't want to touch the C code, just add or replace that file. It get's called even if it's an IPAD (meaning, actually default.png is for iphone, but ...well whatever, just try it!)

I followed the documentation regarding adding the UILaunchImageFile key to the .plist file http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html .
This works but you have to remember to drag and drop your ipad image into XCode. It will not work by simply adding the file in the file browser, you must use Xcode!

Related

Black screen instead of launch image on iPad

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.
On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.
I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.
What am I missing?
Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).
I don't face this issue of launch image with iPhone worked fine in all iOS versions.
Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.
Steps :
Step 1:
Step 2:
Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.
Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.
If you have the same situation like mine, that's solution:
My app is landscape only, iOs7 only, ipad\iphone (XCode 5).
Problem: black launch on iphone (and simulator), normal launch in ipad.
Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later" boxes. Check "iOs6 and prior" boxes and fill empty spaces with images.
Strange, but works.
Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.
Technical Q&A QA1780
Why does my app launch to a black screen on iPad?
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531.
Now it's up to them.
Using LaunchScreen.storyboard
I was having a similar problem until I found the following settings in the General Project Settings.
Set your Main Interface to your main storyboard file. Mine is called Main.storyboard.
Set your Launch Screen File to your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
After that the launch screen loaded first and then the main story board loaded shortly later.
Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines
I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.
After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.
Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.
Remove previously installed app from the device or simulator, Then relaunch the app after clean.
I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.
Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.
I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).
in Xcode 5 , make sure thay you add all needed images mentioned in your app target.
I am assuming that when you are using Asset Catalog, you have ensured that you have the Images.xcassets target membership added correctly. I am mentioning this since if you have multiple targets, looks like you have to add them manually (and you have not provided any screenshots so one can be sure).
Now that you have not really provided a screenshot of the "LaunchImage" overview of Images.xcassets folder in your project, I can only guess the probable reason. Looking at the fact that the launch images work fine for iPhone (6.1 & 7.0.2 and iPad (6.1) and do not work only for iPad (7.0 and upwards), I think you could perhaps look at as to whether the dimension of the images for iPad Portrait and iPad Landscape are proper for iOS7. Specifically, you should see your launch images and not empty rectangles as seen in the attached pic-
This can happen due to the fact that you still have the iPad launch images for iOS7 created excluding the status bar area. Prior to iOS7, the iPad launch images were created to exclude the status bar area, but it's a must on iOS7 that all the launch images must include the status bar area. Please go through the section "Things Every App Must Do" in Apple iOS7 UI transition Guide (https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf).
The following screenshot should explain what I am talking about-
e.g. you can see that iPad Landscape Retina image dimension for iOS6.1 and previous is 2048x1496 (excluding 40 px for status bar) but the dimension for the same image for iOS7.0 and upwards is expected to be 2048x1536 (including the 40px for status bar). So, if you have not changed your images accordingly, you will see black screen for images on iPad 7.0 and upwards. On iPhones, you will not face this issue since iPhone launch images always cover the status bar, be it iOS6.0 and iOS7.0- so the new UI requirement is already met for iPhone launch images.
I found this answer which worked for our app (iPhone only, but used on iPad): https://stackoverflow.com/a/19448782/1258419
To summarize from that answer:
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
I encountered a similar problem in landscape, my iOS 7 launch image wasn’t displayed while the iOS 6 did. Mine was the iPhone Retina 3.5” launch image.
Since I have another app in portrait that didn’t share this issue, I did 2 things:
In info.plist, under “Supported interface orientations”, I added the
2 portrait modes as well, and put them before the landscape, like
this:
Item 0: Portrait (top home button)
Item 1: Portrait (bottom home button)
Item 2: Landscape (right home button)
Item 3: Landscape (left home button)
Implemented this method in the View Controller:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This works with or without the Asset Catalog.
This is an update for iOS 8.
I got the same problem when I tried to add a LaunchImage to my iOS 8 app.
Apple enables developers to use a xib, whose default name is LaunchScreen.xib, to render the launch view as of iOS 8. I believe developers can use either LaunchImage or LaunchScreen.xib. Unfortunately, I couldn't find any document describing how to deal with LaunchImage after LaunchScreen.xib was introduced. I always got a black screen when I tried to use LaunchImage as the launch view.
My solution is:
Don't think about LaunchImage. Use LaunchScreen.xib. (You have to keep an empty LaunchImage in your Asset Catalog though. I believe it's a bug.)
Drag an UIImageView to the xib and make the UIImageView full screen. Remember to take the size classes and constraints into account.
Set an image whose resolution is enough for iPhone 6 plus to the UIImageView.
Check your all images and see if it is properly placed in the Asset and properly named and sized.
Also check which orientations your are allowing and accordingly add images to the asset.
I had the same problem.
I had to make a workaround: used the Default image for all iOS versions and DELETED the UILaunchImageFile key from info.plist.
I cannot use different launch images for iOS 7 and previous versions, so, I had to use the same "artistic" image for all, instead an image that mimic the first view of the app (which Apple recommends and I prefer), but at least I do not get the black screen anymore.
It looks like the UILaunchImageFile key that allows to use differents launch images for iOS 7 and previous versions is not working properly for Retina iPad in iOS 7.
WARNING: I am still testing the app, so I don't know if could be some side effects.
I also faced the similar issue but its solution was simple (in my case).
All I did was following -
1.Add a new file (if you have not added it) Launchscreen.storyboard
2.Get a UIViewController, mark it as Is Initial View Controller then add a UIImageView in it and set a picture which you want to display during launch of your app. Make sure you give this UIImageView required constraint.
3.Go to Project->General->App Icons and Launch images and select Launchscreen.storyboard as Launch Screen File (There will be a dropdown for it).
Because of iOS 13 and later, app launch different than earlier versions.
Get the solution from below URL.
https://stackoverflow.com/a/59913274/883505
I simply forgot to call super.loadView() in my view controller...
override func loadView() {
super.loadView()
}

iPhone landscape-only no launch image for iOS7 R4 image asset

I'm fairly certain this is a bug, but in case anyone has found a way around this, let me know.
I've set up an asset catalog in Xcode-5 of launch images. If I set an iOS 7 R4 image it is only used if my app supports portrait orientation. My app is landscape-right only and I do not see the launch image.
The iOS 5,6 images work just fine, and the R4 iOS 5,6 image will actually load "correctly" if I leave out the iOS 7 R4 image.
Has anyone been able to get this to work?
Update
I've found that I can get iOS 7 landscape images to appear, but only if I remove the default (iOS6) images, which doesn't really help me. If you edit the info.plist and change the image orientation to "Landscape (right home button)" (for example), then provide a horizontal image, it will actually show it on iOS 7 at launch. Unfortunately, if you include an iOS 6 image, it shows that instead. Also, you will not see the iOS 7 image listed in the "General" tab of your target if the orientation is anything other than Portrait. This is with Xcode 5.0 and iOS 7.0.2.
My Solution is Don't use asset catalogs and provide
Default.png (320x480)
Default#2x.png (640x960)
Default-568h#2x.png (640x1136)
as bundle in project and iOS will automatically found them(Apple doesn't have landscape launch image for iPhone or iPod, so we need to provide rotated 90 degree of landscape image)
You may need
Default-Landscape#2x~ipad.png
Default-Landscape~ipad.png
if you do iPad too.
Don't forget to delete fixed launch images name in your Project-Info.plist if you have
The solution that we have found is to update the asset catalog and target only iOS 6 and Prior.
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
Not enough rep to add a comment, so I'll post an answer to clarify a couple of things.
I wouldn't recommend remudada's answer as it is a workaround that may not be compatible for future releases, and, it does contain that black border problem. Generally warning are there for a reason.
NAlexN's answer works as it addresses the problem - iOS is looking for a portrait splash screen, but if the portrait button is off - problem. So, keep the portrait button on and add to your viewcontroller the following:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
I ran into the same problem with my landscape - only application, and here is how I solved it:
Navigate to General tab in your project settings, iPhone Device Orientation section and deselect checkboxes beside Landscape Left and Landscape Right, and select Portrait orientation.
Run the app on iPhone 3.5 or 4 iOS 7 simulator with this settings. The app could crash if you have hardcoded Landscape masks somewhere in your app's view controllers, but it does not matter.
Put checkmarks back for Landscape Left and Landscape Right, but leave Portrait orientation allowed as well. That is you should allow Portrait and both Landscape orientations for iPhone.
I solved it this way:
Go to the project settings and select "Don't use Asset Catalog" in the launch images section. Now you can add the launch images the traditional way. You can still use the asset catalog for the app icons and other images
In XCode 6.1 For IOS 8...Use Launch Image Source as Launch Image...and Replace Launch Screen File from LaunchScreen.Xib to Blank..
Hope this will help........

How to add these three files properly?"Default.png, Default-568h#2x.png, Default#2x.png" for universal app for iPhone/iPad?

I added "Default.png, Default-568h#2x.png, Default#2x.png" these three files in my universal project for splash image, I have three diffrent image and the resolution exactly the same as mention in apple docs, for iPad 768 * 1024 , for iphone-4s -> 320 * 480 , for iphone 5-> 640 * 1136.
But my problem is that when I rum on iphone4s- iphone5 the splash rum properly, but when I run on Ipad the Deafault.png splash not showing instead of it takes reference from Default-568h#2x.png. The Default-568h#2x.png is showing on the iPad instead of Deafault.png and the image got blur and shrink on ipad also, beacuse Deafault.png not showing. How to slove this problem.
Any Idea or suggestion from experts would be highly welcome.
Launch image naming should be similar like this for universal application.
iPhone > Default~iPhone.png,Default#2x~iPhone.png & Default-568h#2x.png.
iPad > Default-Portrait~iPad.png,Default-Portrait#2x~iPad.png,Default-Landscape~iPad.png,Default-Landscape#2x~iPad.png
Please refere the following link for more details regarding image resolutions
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
and for image naming conventions use the following link
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/App-RelatedResources/App-RelatedResources.html
First I would like to suggest that,
Preapre all Images,
Select Project from Project Navigator And Go to Summary and scroll down this
screen appears, then right click on that and choose file from your
computer it will automatically copied to project and it will entered
in plist file also..
if your application is universal then you have
to set for iPhone and iPad Both.
`
See the offical document at chapter App Launch (Default) Images:
App Launch (Default) Images
Only you should do is set the launch image a proper name with relative size, then add those images to the project. Xcode will help you to display it correctly when app launching.

Images for retina display iphone

I have an working application which i have tested in my ipod touch. Everything works pretty fine.
My tabbar icons and splash screen images are in a separate folder in my Resources folder
Resources->images
Now, I know for iPhone4 i need to use 2x images.
My question is for support for iPhone4 all that i need to do is add 2x images in my images folder. For example if my splashscreen image is Default.png, I should add my 2x image as Default#2x.png in my images folder and iphone will use it automatically.?
Is it the same for all tabbar images ?
Thanks in advance
Yes, all that you said is correct. Remember to also import the #2x images into your Xcode project (e.g. by dragging them from Finder to Xcode), so they'll be added to the bundle when you build your app.
For the apps I have worked on, I have only one image in this format:
myImage#2x.png
When I reference this image, I make the following call and it always works, whether on a 3GS/iPhone 4 or iPad.
[UIImage imageNamed:#"myImage.png"]

How do I make an app icon for different versions of iOS?

I want iPhone app icon and graphic (not only the app icon shows on springboard but also in app inner view) auto meet on OS3 device and OS4 retina device , does it exist a way auto meet but coding ? as I know that we can set the icon configure in setting.plist to define the different app icon on springboard but seem no way to set the inner icon or graphic of the app ....
Every graphic that you display on a normal-resolution device has an #2x counterpart for a high-resolution device. This applies both to app icons and to the graphics you use within your app.
For example, if you had an image called navbar.png and a hi-res one called navbar#2x.png both in your Xcode project, when you specify it as the image of a UIImageView in Interface Builder or when you specify it in code:
[UIImage imageNamed:#"navbar"];
iOS will automatically pick navbar#2x.png for hi-res devices without you having to write any extra code.
Create all of your graphic assets at the two sizes, then name the double-sized assets with "#2x" at the end of the name. ie: Icon.png and Icon#2x.png. The iPhone will automatically choose the correct one.