using xcode 7 I wanna to create a Launch Screen with the same image for all iPhones.
In the application main target -> General -> App Icones and Launch Images -> Launch Image Source I have selected the "LaunchImage"
In the assets I created a LaunchImage (App Icons & Launch Images->New iOS Launch Image) and I put all the images applicable to the various devices.
When I start my app there isn't launch image. Anyone know why? Thanks to all
As i mentioned in the comment remove the Launch screen file value from the Launch(application main target) -> General -> App Icons and Launch Images -> Launch screen file, so it will be likes this
After that you run it, it should be there
I solved it with this code:
extension UIImage {
convenience init?(fullscreenNamed name: String) {
switch UIScreen.mainScreen().bounds.size.height {
case 480: //iPhone 4/4s
self.init(named: "\(name)-700#2x.png")
case 568: //iPhone 5/5s
self.init(named: "\(name)-700-568h#2x.png")
case 667: //iPhone 6/6s
self.init(named: "\(name)-800-667h#2x.png")
case 736: //iPhone 6+/6s+
self.init(named: "\(name)-800-Portrait-736h#3x.png")
default:
self.init(named: name)
}
}
}
I take in "LaunchImage" the right image for the device screen in use.
#Pyro, thanks for your help
Related
How the iOS6 decides if the app must be run in letterbox/compatibility mode on iPhone 5?
Is this a build settings parameter (like the "Targeted device family")?
Or all apps build against the latest SDK MUST support iPhone 5 screen size?
Or the app will be run in letterbox mode is there is not a 1136x640 Default.png splashscreen ?
Or what else?
The app will run in letterbox mode if there is no 1136x640 Default.png splashscreen.
The image must be called Default-568h#2x.png (if your splashscreen is Default.png in your Info.plist)
You will need to add IOS8 specific splash screen too. In my case i had 1136x640 Default.png splashscreen but you need to select launch screen and select orientation as shown below
This worked for me. Hope this helps :)
I didn't try adding the splashscreen (special because I didn't have any image by the time), but instead just went to the
Target General settings -> App Icons and Launch Images -> Launch
Images Source
and created a new catalog. Didn't add any image to it, just run the application and the black bars were gone.
Hope this helps anyone.
I develop application using iOS5.0, now I want to run app in iOS6.0. It's working fine using iPhone classic devices, but not working fine in iPhone5.
Because [[UIScreen mainScreen] bounds] is returning {{0, 0}, {320, 480}} in iPhone5, I wrote code using
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CGSize result = [[UIScreen mainScreen] bounds].size;
if (result.height == 480)
{
// iPhone Classic
}
else if (result.height == 568)
{
// iPhone 5
}
}
But screen bounds return same frame. How it will change?
Add splash screen for iPhone 5. You can see a warning if you go to Your Target -> General -> Launch Images.
For the application to run in "tall mode", you need to have a Default.png splash screen the correct height for an iPhone 5. This will instruct the application to run in tall mode, meaning you'll get the correct bounds.
Information can be found at the Apple Dev Centre. Basically, you'll need to provide a splash/launch image with a size of 640 x 1136 pixels, and a name of Default-568h#2x.png.
To specify default launch images for iPhone 5 and iPod touch (5th generation) devices, include the modifier string -568h immediately after the portion of the filename. Because these devices have Retina displays, the #2x modifier must always be included with launch images for the devices.
For example, the default launch image name for a device is Default-568h#2x.png. (If your app has the UILaunchImageFile key in its Info.plist file, replace the Default portion of the string with your custom string.).
You can easily add this image via the target settings for the project in Xcode. Simply select your project file, then select the application from the target list. Within General, you'll find settings such as Application Version number, Deployment Target etc... Further down the list you can select your launch images, and there'll be a placeholder for iPhone 5 devices.
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........
I have an image named abc.png of size 320 by 156 which runs well on iPhone 4 and an image named as abc#2x.png of size 640 by 312 which also works fine. but when Please enlighten me on how to use the image for the iPhone 6 device?
First of all there is nothing like iPhone6 as of now, it is either iOS6 or iPhone 5.
But I guess you are talking about iPhone 5 with screen resolution 640X1136.
There is no in-built way to select image for iPhone 5.
if you have abc.png and abc#2x.png in resources , and you use a code like:
UIImage * image = [UIImage imageNamed:#"abc.png"];
it will pick abc.png for non-retina display and abc#2x.png for retina display(that includes iPhone 4S and iPhone 5).
If you want to load separate image for iPhone 5, you will need to check the screen height:
if(screenHeight == 480)
{
//iphone 3,3G,4
}
else if(screenHeight == 960)
{
//iphone 4S
}
else if(screenHeight == 1136)
{
//iphone 5
}
This way you may load different images for different iphones.
Please uprate and check the answer if it answers ur question.
The answer to your question, I'm afraid to say, is something called AutoLayout. That's the solution Apple came up with to deal with the different form factor for iOS 6 views. Only #2x images are available, but with AutoLayout, you can tell it exactly how to behave.
Here's a nice tutorial on how to use AutoLayout, I tried it and it works well:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2
How the iOS6 decides if the app must be run in letterbox/compatibility mode on iPhone 5?
Is this a build settings parameter (like the "Targeted device family")?
Or all apps build against the latest SDK MUST support iPhone 5 screen size?
Or the app will be run in letterbox mode is there is not a 1136x640 Default.png splashscreen ?
Or what else?
The app will run in letterbox mode if there is no 1136x640 Default.png splashscreen.
The image must be called Default-568h#2x.png (if your splashscreen is Default.png in your Info.plist)
You will need to add IOS8 specific splash screen too. In my case i had 1136x640 Default.png splashscreen but you need to select launch screen and select orientation as shown below
This worked for me. Hope this helps :)
I didn't try adding the splashscreen (special because I didn't have any image by the time), but instead just went to the
Target General settings -> App Icons and Launch Images -> Launch
Images Source
and created a new catalog. Didn't add any image to it, just run the application and the black bars were gone.
Hope this helps anyone.