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

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.

Related

Creating auto layouts for iphone se?

I'm making an app that I want applicable to all sizes but the problem is that iPhone 8 up to iPad devices are good but I noticed that the iPhone SE and below iPhones are not being supported when you make your app for iPhone 8 and up because it's so small. Now does that mean I have to create a scroll view for all my pages not since it doesn't fit for iPhone SE and below or is it recommended to not just include iphone se size and below for any future app?
It's recommended to create your app to be universal and support all screen sizes to hit users from the market as much as you can , regrading support for IPhone 4 , 5 I think you need to have a scrollView in any screen that you think it may exceed screen height for these 2 devices , or create items height in proportional to screen height to guarantee that all UI elements will fit in the screen

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.

How to Support All iPhone Screen Sizes

I have an app in Xcode 6.2 with the storyboard supporting all devices. For some reason, whenever I load the application on the iPhone 6+, or iPhone 4s, or iPad, the screen doesn't take the size of the iPhone/iPad. However, on an iPhone 6, 5s, and 5, the screen takes the full size of the iPhone. Why is this? I am very unfamiliar with sizes and how to properly support all sizes. Right now, I have set the screen sizes in the storyboard for each view controller to 320 x 568. The width is "Compact" and the height is "Any".
If this has anything to do with this, my iPad screen comes out blank. It's just white. Apple recently rejected my external testers app submission due to this.
I have done lots of research on these 2 questions, but I had a hard time understanding anything, as I am new to iOS Development.
To properly handle varying sizes and how that affects your layout you will want to use auto layout. Check out this great tutorial from ray wenderlich to get you started. Once you get started feel free to post more specific questions about any roadblocks you run into. Good luck!
http://www.raywenderlich.com/64392/video-tutorial-beginning-auto-layout
When you want your app to work on any device, ideally you should keep the width and height both set to "Any". You should switch to "Compact" or "Regular" width or height only if you have any requirement specific to a particular device. To understand things in detail read more on Size classes. It is very nicely documented in this Apple developer site.
iphone:
iphone 4- 320x480
iphone 5- 320x568
iphone 6- 375x667
iphone 6plus - 414x736
and also ipad:
ipad mini - 768x1024
ipad air - 768x1024
ipad pro 10.5 - 834x1112
ipad pro 12.9 - 1024x1336

Xcode 6 Auto Layout - Constant horizontal spacing between UI elements across all devices

I am designing an iOS 7+ app on Xcode 6 for the iPhone 5s, iPhone 6, and iPhone 6+. I want to create a single design for all of these devices, so I am using Auto Layout. I would like the spacing between UI elements to be the same on all devices, but I am having trouble accomplishing this. Here's a screenshot of one of my UIButtons on the iPhone 6 Simulator at 100% scale:
(The white boxes are spacer views, but don't worry about them.)
As you can see, the horizontal spacing from the left edge of the UIButton to the left edge of the UIViewController is 37px. On the iPhone 5s, this spacing is 32px. I would like the spacing to be 32px on all devices. On Auto Layout, I set my horizontal spacing constraint to a constant of 32. Even with this set, it seems to be scaling the spacing as well.
How can I prevent the horizontal spacing from scaling?
I think your app is not iPhone 6 ready. If your app is iPhone 6 compatible, spacing will be 32px across all devices. Otherwise, iOS draws screen 320px in width and scale it to fit actual screen width. That's why you're getting 37px in iPhone 6.
To make app iPhone 6 compatible, create launch screen file (new file > iOS > User Interface) and assign it as the launch screen file in your project settings. Then app will launch in devices native screen resolution.

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

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)

Resources