How do I handle iPhone 6S Plus's font size? - ios

iPhone 6S Plus's screen is very big compared to other screen sizes. I can't seem to find a good way to handle the font size of a label without adjusting the size programmatically.
How can I adjust the font size of a label so that it looks smaller on an iPhone 5 and bigger on an iPhone 6 Plus?

Don't change font sizes for the iPhone 6 or iPhone 6+.
People buy these phones to see more content. The 6+ displays things slightly bigger than the other phones anyway (yes, it has bigger pixels, not just more pixels), and if a user wants an even bigger display they can switch the whole phone to zoom mode (both 6+ and 6; this turns a 6+ into a large 6, and a 6 into a large 5).
Just use autolayout to position things relative to the screen size.

You can't target iPhone 6 Plus using AutoLayout because it's not meant for hardcoding sizes. You either need to use code and do something like this:
if UIScreen.mainScreen().bounds.size.width == 375 {
// iPhone 6
label.font = label.font.fontWithSize(20)
}
or just create a invisible view and set top and bottom constraints to it.

I think it is better to use adaptive fonts (here is an example, section Adaptive Fonts)

Related

Xcode 8 Vary Traits with autolayout issue

Ok I've finally taken the plunge into autolayout using Xcode 8.
I might conceptually have the wrong idea. However I have a view in IB which has 2 labels a button and an imageview dead center in the view with dimensions 300 x 300 for 6plus and 6 devices.
What I want to do is vary the imageview size for iPhone 5 (SE) so I click Vary for Traits and select height and width then change the values to 150 x 150 click done and the all looks good looking at iphone 5 (SE).
Now flicking back to 6plus and 6 its also resized to 150 x 150 but I want the image size to remain as 300 x 300. Again I may have the wrong idea completely.
I thought the whole point in this is that its varying the size dependant on what is selected i.e. varied.
Vary for traits or size class is not used to change autolayout for different devices, rather it is used to change layouts for Regular and Compact size of (width or height or both).Too many devices come under regular width like ipad pro iphone 7 plus, etc.
same iphone se and iphone6 in portrait mode has same width thats is Compact.
So when you change for one it changes for both.
When you choose vary for traits and select width+height checkbox it shows some devices in blue box it means all those will be effected.
Better do it programmatically, check device type and set size according to it.

size classes for portrait only iphone Apps?

I had an application which is used for portrait only iphone.So i set the size classes to compact width and regular height as suggested.But when i am adding an imageview which is 400*800 and its 2x,3x its not showing properly in iPhone 4s.But it is not showing correctly in 3.5 inch phones,I am getting this in launch screen storyboard which i filled with one imageview.Can anybody guide me in right direction in achieving this ?
Size classes are based on ratio of width and height, not size. In portrait, iPhone 6, iPhone 5, and iPhone 4s all use the compact horizontal and regular vertical size classes. So They could look different on each.
When you design UI Interface for 3.5 inch iPhone in Storyboard, you should set the Size to iPhone 3.5-inch in Attributes Inspector. By doing this, we ensure what we will see in simulator is same as in Storyboard.
Sometimes, You may need to make size class specifically for portrait 3.5 inch (iPhone 4S).Then you need to set auto layout according to the size of screen, like:
if (UIScreen.mainScreen().bounds.size.height == 480) {
//Set your auto layout here
}

How to let Xcode know which asset to use for the target iPhone?

I am designing an app for iOS in SWIFT. I have decided that the auto layout will be compact and will be only for iPhone in portrait mode. I wanted to clear up a few hiccups on designing buttons for the 2 different screen ratios: the first being the iPhone 4s and the second ratio being the iPhone 5 and above. Because the new iPhones have a taller height, does that mean I will need to design 2 different ratios of buttons, and if so, how do I use them in Xcode? For example here's the stock apple calculator;
link to picture: http://imgur.com/mkIBghD
As you can see the the buttons on the taller iPhone have a square shape. The buttons on the 4s are more stubby. What do I need to do in Xcode to let the app know which asset to use for the respective phone and how would I implement that in Auto Layout?
thanks
In order to do this you setup autolayout constraints. This will make the buttons change shape/size depending on the device. You do not need to have multiple assets because all the phones you are talking about have the same retina (2x) display.
You need to add three different sized images for a single Image Set in Images.xcassets . The sizes should be 1x for iPhone 4s, 2x for iPhone 6(It'll work for iPhone 5 too) and 3x for iPhone 6 plus.

iOS User Interface for different devices in iPhone 4, 5, 6+ and iPad

From what I know the resolution in iPad is higher than iPhone therefore the same width and height point in storyboard in iPhone will appear to be bigger in iPad. However, I didn't notice the size differences and it seems to be the same which look the same in iPad.(the height of textfield)
Are there any ways for making them scale in the same aspect fit? By right elements in iPad should be bigger due to the resolution. Autolayout has been used in the following picture.
How do I code for user interface for iPhone 4 and iPhone 6+? The same box will appeared to be too big in iPhone 4.

How to deal with iphone 6 size?

I launched my app on iphone 6 and 6 plus simulator. iPhone 6 plus uses #x3 images, but this have the same ratio. However, the iPhone 6 have a screen of 1334 x 750 (667 x 375) ... this sucks!
As you probably know, the app screen automatically fit to those new screen. But for the iPhone 6, images are bigger but they cannot be replaced (#3x is only for iphone6+).
How to deal with this new size?
I have to use autolayout only?
How to set the right screen size without automatically rescale this screen?
As Roger answered, you need to add the iPhone 6 and 6+ launch image
But you don't need to use autolayout. AutoLayout is one way of adapting to different screen resolutions, but the old autoresizingmask (springs and struts) is perfectly fine for most layouts. I use a combination of both as they each have pros & cons.
You need to do a couple of things:
Add a launch image for iPhone 6 and 6 plus.
adopt autolayout.

Resources