stretch old iOS app on iPhone6 Plus screen - ios

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

Related

Can I create a auto scale up app using Xcode 7?

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).

Make iPhone 6/6 plus resize apps automatically

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.

How to prevent Xcode/Interface Builder from auto-shifting view down?

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.

How can I get the Xcode storyboard and the iPhone Retina (3.5-Inch) simulation to use the correct xcassets images?

Weird problem here which may be a bug in Xcode...
Using an Xcode 5.1.1 storyboard with auto layout, I am working on the design of a view controller that contains a full iPhone 4 sized UIImageView that references an xcassets image set. The xcassets image set includes 1x and 2x iPhone 3.5-inch images, and an iPhone 4 R4 image.
Problem 1: Once I set the Image View Image for the UIImageView in the utilities panel using a View Mode of Aspect Fit, the storyboard shows the smaller iPhone 3.5 image with white spaces at the top and the bottom of the view instead of the iPhone 4 image which would fill the entire storyboard representation of the view, as they are the same size since Xcode infers an iPhone 4 sized screen in the storyboard.
Problem 2: If I ignore problem 1 and run the program using the iPhone Retina (4-Inch) simulation, the applications selects the correct image size from xcassets and everything seems fine. However, if I run the simulation using the iPhone Retina (3.5-Inch) simulation, the applications also selects the correct sized image, but pushes the images down and display white space at the top of the page.
Before I start hacking around these problems, I thought I would reach out and see if anyone else has experienced either of these issues. Any help will be greatly appreciated.

Support of iPhone 4-inch screen by storyboard

I created a new project in XCode 5. And I run it on iPhone 5 (which has 4" screen) and a view doesn't cover all screen, but rather squeezed in 3.5" box (there are two black bars around my view)
I went to Main_iPhone.storyboard and checked that:
Use Autolayout is turned on on View Contoller
Use Autolayout is turned on on View
I tried Simulated Metrics, Size: Retina 4-inch Full Screen, Freeform and Inferred.
I tried to use button at the button to switch to Retina 4-inch form factor and 3.5-inch form factor.
Nothing makes a difference and it still shown as 3.5" (black bars around my view).
How can I make sure that iPhone storyboard occupies whole screen on iPhone 4-inch phone?
Update 1
None of solutions in this question: Xcode Storyboard displaying the new iPhone 5 screen size? solved my problem. BTW. That question was for pre XCode 5.
To enable your apps to work with iPhone 5, I suggest you to do two things.
First you need to add a retina version of the launcher image. It should be named Default-568h#2x.png.
And second use Auto Layout and make sure you have your autoresizing mask set up correctly for all your views.
I had the same problem, could not resolve it by any of the above methods. So what I did is copied the Content.json files from old project (where 4-inch was working) into the Images.xcassets Applcon.appiconset and LaunchImage.launchimage directories respectively. Then selected in the project setting in General under App Icon selected Source as AppIcon and in Launch Images in Source selected LaunchImage. It worked. Maybe useful to someone.

Resources