Originally I was used Xcode 5 (w/ iphone5) to create an app, and it worked good on Xcode 6 w/ iOS7/8, even on iPhone 6 and 6+, the app will automatically scale up to fit the new screen sizes. Recently I have migrated to Xcode 7 and found there is a black bars on top and bottom, so I follow the suggestions to include main.storyboard as launch screen file, but now the app will not be able to scale it up automatically. I found a discussion about this: Xcode 6 resizes app automatically for iPhone 6 and 6 plus
So I try to create an single view app from scratch (using Xcode 7), delete the Launch Screen File and Launch Image Sources, put something objects on the view, and then remove Auto Layout and Size Classes from main.storyboard, but the app does not expand to fill the new device size for 6+.
Is it possible to do so?
Simple way is Use xcassets, you need to Create a Launch Image Set and add all images with proper size
Create an assets file. File->Create->Resource->Assets Catalog
Select the file, and add New iOS Launch Image
Add an image for each size. Make sure that the resolution of the file has the same aspect ratio as the required file, but the resolution that you want your app to have. E.g. even though it expects 1242 x 2208 for iPhone 5.5, enter 640x1136, and your app will be scaled down to 320x568 with retina autoscaling
You can find out the expected resolution to determine the aspect ratio in the properties inspector at the bottom of the right tab.
Finally, go to your target's configuration under General->App Icons and Launch Images and set your launch image source to LaunchImage (or whatever you called the image).
Related
I have a very old xcode/objective-c iOS project.
I tried to compile it on the lastest Xcode version and it works fine.
On big iPhones, the application is streched to fit in bigger screen.
I tried to create a new Xcode projet and drag all my source files in the new project. I removed storyboard.
It works, but the application is not stretched. I see 2 black bands at the top and the bottom of the screen.
What i want is just to understand which parameter i have to changed in the project.
This is not a storyboard or size classes issue because i have no storyboard or xib files. I tried to change iOS version déployment target.
Thanks
You need to add a launch image for the large screen size of the plus models or better a launch screen file.
See: here
Add launch images of of accurate sizes as follows for iOS 8 and later.
Goto launchScreen in the XCAssets, you can see these options on the right pane see the image attached.
and add images with size :-
Image type Size
Retina HD 5.5″ 1242 × 2208 pixels
Retina HD 4.7″ 750 × 1334 pixels
All my old apps are looking good on iPhone6/6+. But when I create new project iPhone 6/6+ treat apps natively. So they look awful. Instead of trying to adjust views using constraints and stuff, I decided it would be better to write app for iPhone 5 and let new iPhones scale it. I know solution is not perfect but is good enought for me. The questions is how to make new iPhones treat my app as iPhone 5 app. How to make them scale it?
Thank you.
You have to provide a LaunchImage with the correct size :
iPhone 6 Splash screen 750 x 1334
iPhone 6 Plus landscape Splash screen 2208 x 1242
iPhone 6 Plus portrait Splash screen 1242 x 2208
I'm answering this by memory as I don't have xcode in front of me, but I'm quite sure it's correct.
You need to create and add 3 launch images to your project of the following sizes:
*640x1136
*640x960
*320x480
Go to project settings, general and select the launch image source option. Select use asset catalog, and create an asset catalog if you don't already have one.
With the asset catalog open you should have a section called launch images, if you do not, tap the '+' button in the bottom left hand corner and add the launch images option to your project. Select the launch images option.
The top row of images are used for iPhone 6/6 Plus, leave these blank. Drag and drop the launch images that you created onto the bottom two rows of images.
Return to your project settings and select the launch screen file option. Remove everything - ensure that the selection is blank. (To do this I selected my main.storyboard and just deleted the text in the text box).
And that's it, now you can automatically zoom your app on the larger devices.
Hope this helps.
I'm using the current Xcode and targeting iOS 8.
I'm wondering if it's okay if in my LaunchScreen.xib I put a single imageView that is constrained to all sides of the parent container. Within that image view will be my splash image called: splash.png;
Now here's the kicker, this splash.png will be hi-res and all devices (iPhone/iPad) will use this one image. Is this ok according to apple's guidelines? (note: it's okay with me) I don't mind if it stretches to fit). Also note my app's only in portrait.
Yes. It's fine, that's because they introduced this new feature (launchscreen.xib).
For deployment targets prior to iOS 8, you add a set of launch images to an asset
catalog for each of the possible screen sizes.
New projects are created with a launch screen file called
LaunchScreen.xib. Alternately, you can create a new launch screen file
using File > New, selecting the User Interface category, and choosing
a file type of Launch Screen. The launch screen uses size classes to
adapt to different screen sizes and orientations, see Adapt to Multiple iOS Screen Sizes and Orientations with Size Classes for more
information.
Reference : Create and Set the iOS Launch Images or Launch Screen File
Without modifying any code in a new Xcode 6.0 Single View project targeting iPhones running iOS 7.1, the result on my testing iPod Touch 5th gen device shows a shifted version of what's in Interface Builder. It appears the shift is downward. I've already tried turning off Auto Layout and Size Classes, and resetting all UIView coordinates to (0,0), but still the battery symbol and upper bar is too far down! Please see pictures below for Interface Builder screenshot, and device screenshot. The question is how can I keep what I see in Interface Builder, and stop the iPod from shifting down the entire UIViewController? Thanks!
UPDATE: In the end, I had to go into project build settings, click on the app under Targets, and change Launch Images Sources to a new folder it titled "LaunchImage-2" and delete the Launch Screen File field, which was set to Launch Images.
If you don't add the Default-568h#2x.png
then xcode build the project of size 3.5 inch and shows black patch at the bottom.
So you have to compulsory add the image with name Default-568h#2x.png of size 640 x 1136
If you use an empty Asset Catalog for your Launch Images, the iPhone 5's screen size is supported (without having to include any image files at all).
It seems that you need to add the default or launch images into the project. Your project should be using image assets, so there you will see launch images and you need to supply images of appropriate sizes, preferably for all iPhone screen sizes.
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+