I constructed the storyboard in the size class "compact width and regular height." when i run it in the iPhone 6 simulator, it looks fine and exactly as it does on the screen. but when i run the app on the iPhone 5 simulator, the images run off the screen. basically all the elements kept their exact size and did not scale down to the smaller screen size of the iPhone 5.
likewise, when run it in the iPhone 6plus simulator there is a lot of extra white space.
how can I fix this? is there an easy fix or do I have to remake all of the storyboards that I've done?
Since you are doing it with the IB you need to set aspect fill. Sometimes constraints will complain if you do this so only set ones that won't hurt you.
Related
I want have an image on my launch screen which occupies the same amount of the screen on different devices.
At the moment I have a logo which is about the right size on iPhone 4s, but on iPhone 6 Plus it's too small. Obviously these devices are in the same autolayout class.
I know I could use proportional sizing, but this will stretch the images and make them look fuzzy.
Also with it being a launch screen I can't use code for drawing or custom controls.
I guess I need some way to determine different devices in my constraints.
Add LaunchScreen asset group to your Assets. Then it will be possible to assign custom image for each screen resolution.
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.
I'm working on an iPhone only app supports from iOS 8. I want to support devices from iPhone 4S in a portrait mode only.
I have a graphic design which is taking a fullscreen content. I'm using auto-layout to handle the views and making it work for all screens. But, I'm using a small assets to manage the design to work from iPhone 4S. When I see it in iPhone 6S/6, contents are very small and lot of extra spaces are getting wasted.
I want to increase the font size, image sizes when a device resolution is getting bigger. There are many screens in this app.
For e.g., I've a label with font size 10pt in iPhone 4S screen. Even
after scaling, I see that font size is small in iPhone 6/6S. I'd like
to increase the font size to 13pt or higher.
How to handle that? Any ideas would be appreciated.
UPDATE:
I'm supporting only for iPhone in a portrait mode. When we do that, all screens are having size classes with Regular Height & Compact Width. So, storyboard setting for different fonts will not have any change in the actual screens.
To manage Images for all devices add images to Images.xcassets folder for all devices by adding 1x, 2x and 3x images.
To display font according to size of device you can use size classes for different devices.
Tap small plus button in front of Font in Attribute Inspector and maintain size for different devices.
Thank you for other fellows.
Earlier, I wasn't aware of 'Minimum Font Scale' & 'Aspect Ratio' options in Autolayout.
After some researching, I could accomplish resizing of views and font sizes with them. Here are the few answers which helped me.
https://stackoverflow.com/a/28909109/1083859
https://stackoverflow.com/a/31853203/1083859
https://stackoverflow.com/a/25768875/1083859
I have 2 UILabels and 2 UICollectionView set up with Autolayout so that they will look the same with different device sizes but it doesn't appear to be doing so.
Problem
I am running into a problem which is that the second UICollectionView located at the bottom appears to be cut off when tested in the iPhone4S Simulator or that there are really huge extra empty spaces when tested on the iPhone6+ Simulator.
Details of pictures below
The first picture is iPhone4S Simulator whereby certain parts of the UICollectionView is cutoff. The second picture is iPhone6+ Simulator and that it has too much empty spaces for some reason and is not scaling to fit.
The last picture is of iPhone6 Simulator, which is my ideal layout.
!enter image description here
Ok, here is the problem I have designed an application for iphone 6 screen without size classes and autolayout.
Looking like below in the storyboard. As you can see its simulated size is 4.7 inch.
It works perfectly when running on iphone 6 devices obviusly.
However when trying to run the app in other devices than iphone 6 it wont scale proportional.
My hope was that if I removed the lanuch screen images only keeping the iphone 6 size it would scale to fit other screens looking the same as if it where run on a iphone 6 only scaled up or down depenging on device.
My launch screen looks like this now
It does infact scale the app but it scales the app in wrong proportion making it looked chopped like this.
Iphone 5s version of the app looks like this
As you can see it scales correctly but the aspect gets wrong compared to the iphone 6 version below scaling correctly.
Here is an ipad version looking like the iphone 5s version scaling wrong.
It seems to me that the scaling works since I have removed all launch images except the 4.7 display (iphone 6) The problem however seems to be that it scales keeping the aspect of an iphone 5 in width making the iphone 6 display to wide.
I have tried to add launch images for all devices but the problem then is that I need to use autolayout and size classes to make it work.
Is there any way to for instance tell the scaling to keep aspect but use iphone 6 width and height intact without using size classes etc.
To make the question even more simple. Is there any way to scale an app made for strictly iphone 6 so resize to iphone 5s/ipad?
Any help is highly appreciated!
Well, the "trick" with removing the other launch images doesn't work, as you noticed yourself.. This automatic scaling only works from 4" to 4.7" and 5.5" and is only to support older apps on the new devices, not for general purpose "I am too lazy to support all sizes" use cases.. ;-) Apart from that, you should definitely support the native resolutions.
So, to answer your question: You can either just use Auto Layout. This is definitely the preferred approach - after all that's exactly the use case that it has been built for.
Alternatively, if you really don't want to or can't use Auto Layout, you either need to make sure to set your auto resizing masks correctly (e.g. "flexible width" on the stuff that needs to grow/shrink horizontally etc.), or adapt your frames manually in code (which partially defeats the purpose of IB).
If you didn't use Auto-Layout or Size Classes, your only hope is to programmatically change the positions/size of each element individually in the viewDidAppear or viewDidLayoutSubviews method of your LoginViewController. You would have to do it also on orientation change (if your app supports it).
It's a lot of work that can be easily be avoided by using Auto-Layout/Size Classes!