Auto layout 3.5 - 4 inch screen as well as ipad mini to normal? - ios

I know to go from the 3.5-4 inch screen with the app you create you have to use auto layout to make it nice on both screens. I was wondering if you had to do the same for the ipad mini - ipad? When i go into the attributes inspector there is no ipad mini choice on the view controller like there is for the 3.5 inch display. With the ipad story board is it a one size fits all type of thing or should I still use auto layout?
Thanks
Shen Hutah

The reason for resizing with the 3.5-4 inch screens is due to a changed aspect ratio. With iPad and iPad mini, they have the same aspect ratio (4:3), so the screens are functionally the same. Unless you're altering the view based on autorotation, there's technically no need to use autolayout.

Related

iOS auto layout support for all iphones?

I'm using autolayout storyboards for my ios app which is only for iPhone. When I submit, Apple reject it saying that the app should support iPhone 3.5 inch for ipad view on iphone resolution but making the UI for iPhone 3.5 inch is bit hard.
If I change it to support iPhone 3.5 inch onwards it gives bad view for iphone 5 inch. The contents are not centric there's long space for iphone 5 inch. What are the solutions?
Can I configure the settings to support iPhone 4 onwards?
or else Can I make two storyboards for iPhone 3.5 inch & 5 inches?
Yes, you can make 2 storyboards and switch them, depending on screen height, but why you can't adjust constraints for all iPhones screens? Usually this is possible.
One way for complex layouts - create constraint outlets and change them in code.
Another way - divide design to smaller UIViews, that contains elements, like container and set constraints between them.

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
}

Is using constraint/auto-layout on iPad a mandatory?

All iPad screens, iPad 1, iPad 2 ... , iPad Retina and Mini iPad have the same screen ratio. width/height or height/width or width:height
So, Why do we need to use constraints for the iPad views?!
I also believe that in interface builder when you select the view controller, you can view it as iPad or iPhone. there is many iPhone options but only one iPad option. you can do that by clicking the size drop down list in the Attributes Inspector.
Is there any of the iPad screens that have more or less screen points comparing to others? "Screen Points" not "Screen Pixels" if yes, Which one is that?
You don't have to use auto layout, but it's a good idea to. Once you understand it it's faster to work with, more flexible and very powerful for animations. You should also consider device rotation and usage for things like multi-tasking (ios9, use size classes too).
If you Design your Screens in Width Any / height any than your design will run on any iphone and Ipad Screen with autolayout. And it's a good practice too. if you want any change for iphone / ipad screen than you can remove that constraint for particular devices.add particluar constraint for particular devices.

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.

Hiding a view based on screen size.

I tried to search but could not find anything. Or could not ask the right way... =\
Anyway I have a simple UIViewController that no mater the screen size things look great. I was asked to add some text to it and this is where the problem arises. On 4.7 and 5.5 screens I have enough room but not on a 4 inch screen. Playing with size classes I can not find a way to indicate a 4inch or smaller screen only. I want to NOT show the UILabel on a 4 inch screen and DO show it on the other larger two. I'm sure this could be done in code by [lbl setHidden:YES] if the screen size is less that x. Is there a way to accomplish this in Interface Builder so I am able to show the boss the layout without having to run it in different simulators or devices? I.E. using the preview editor.
You should play around with Installed property in Attributes Inspector, but you cannot hide for only 4 inch screen, because wCompact and hAny is for 3.5, 4, 4.7 inch, wCompact and hRegular is for all iPhone portraits, thus you will hide the label for 3.5, 4, 4.7 inch if you uncheck Installed property for wCompact and hAny. For such behaviour, you should do by code.

Resources