ImageView Scaling for iPhone 6 and 6+ - ios

So Im making a game without the use of auto-layout. I have used constraints to scale everything and it worked perfectly. However, there are 12 image views that scroll down. 6 on the right a 6 on the left.
This is done based on a code i've written and places the images via arc4random.
The images on the left are completely fine and scroll down so that there is no gap between the side of the screen and the image. As do the images on the right when using the iphone 4s and 5.
HOWEVER.. when it comes to trying this on the iphone 6 and 6+, alot of the times, there is a gap between the image and the side of the screen on the RIGHT. the LEFT is fine. I want to know how I could solve this issue. This is more of a general problem so dont need to include code.

You can try disabling iPhone6 and iPhone6 Plus support for the app so that they work fine on the new devices (via scaling)
Remove "Launch Screen File" from Target General Settings and if you are using Asset Catalogs for Launch images, under right panel for the asset catalog under Launch Images-> remove launch images for iPhone Portrait and Landscape for the category 'iOS 8.0 and later'
This is a workaround that makes iPhone6 and iPhone6Plus to scale views according to the screen size.

Related

Removing launch screen file from Info.plist scales the views

I noticed something that when you remove the launch screen file entry from the XCode Info.plist file, any view of any view controller becomes scaled according to the screen size, so the views appear zoomed in on large screen sizes such as the iPad Pro (12.9 inches) and appear somehow zoomed out on smaller devices (iPad Pro 9.7 inches).
In that case it seems that the Auto Layout constraints have no effect as the scaling is done automatically.
I really can't understand what does this has to do with the layout constraints, so I appreciate if any one can explain what's the reason for that.
Without being able to provide deep details, iOS uses the launch screen definition (view or static images) to determine which size classes the app should use. If you have not supplied those, it seems you get scaling that you generally do not want.
That doesn't mean auto-layout no longer has any affect... it just means that the auto-layout engine is not using the current screen size for its size/positioning calculations.
You'll see very similar results if you explicitly set your project for iPhone only.
Simple, obvious solution: Don't remove the launch screen.
Yes this is expected behaviour... Same is for iPhone 6 Plus. If you remove the iPhone 6 Plus launch screen, it will display the iPhone 6 scaled version.
This is just for backward compatibility. If your app is not ready for iPad Pro or iPhone 6+, scaled version can be used by removing the respective splashing screens.
All current iPhone apps or iPad apps in AppStore those are not optimised runs as a scaled version.

Black bar appears on top when running on iPhone 6 & iPad Pro Simulator

When I run my game on the simulator, specifically on iPhone 6 and iPad Pro, it shows black bar on top of the screen. I have looked the answer up online and have literally tried every single thing and have went through all the answers, but none have worked. My deployment is set to 7.0 and have tried running with setting just set to LaunchImage from asset folder and LaunchImage & LaunchScreen.xib combined. I also do have the right size pictures required in asset including iPhone Retina 4, as well, and that doesn't fix the problem either. Is this just a glitch on the simulator or there is a way around this?
I got it working. For some reason my 2x images were short for the screen size, and had to extend them more. Even though height wise, my images had more length than the screen size.
Hope this helps people. I came across several people who had done everthing right, but still couldn't get it working. I believe it is because image isn't large enough to cover the whole screen
Stretched mode?
Are you providing Default screens in all sizes as suggested in:
Dealing with iPhone 6/6+ startup images
How to Update Your Apps for the 4-Inch iPhone 5 Display
Restoring integrity in Startup screens
Images clipped?
If not running in stretched mode, pick a View Mode best suited for your images, such as Aspect Fill and Scale to Fill, both of which will cover your UIImageView in LaunchScreen.storyboard.
Add Default-568h#2x.png Image with resolution 640x1136.
Make sure 'App Icons and Launch Images' look like below image:
it worked in simulator with iOS 9.

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.

Autolayout not working on iOS7 and Xcode 6

I've started using Xcode auto layout for my projects.
Auto-layout works perfectly when I'm testing on ios8 devices, it the view scales as needed.
However, things get a little crazy with ios7.
When I test my app on an ios7 iPhone 5 simulator, the app doesn't scale-up to the larger screen,
but only shows the 3.5 inch view, leaving black bars on the top and bottom of the screen.
I am using a tableView controller.
How do I scale the tableViewController up so that it fits on a larger screen in ios7?
(Like I've said, my app fits perfectly in ios8, on all screen sizes, but not in ios7.
Also, it scales fine on an ios7 ipad.)
thanks.
The Xcode (6) IDE should give a warning about this, that may not be so clear:
"Applications using Launch Screen Files and targetting iOS 7.1 and earlier
need to also include a Launch Image in an Asset Catalog."
This means you need to have the proper Launch-Images for the "Retina 4" screen,
which is 640 × 1136 pixels, and it should be configured in the assets-catalog,
just like your Application-Icons ("AppIcon"), but under "LaunchImage" there.
Once you add this 4-inch-compatible Launch-Image to your application,
iOS-7 will assume you are properly supporting the "Retina 4" screen,
and will launch the application in 4-inch mode.

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.

Resources