How to handle Layouts for iPad pro as there is nothing to manage different image sizes in xcasset. also my current UI for iPad air 2 seems to b disturbed in iPad pro. any suggestions or a way to handle it?
You can't do in image asset.
Both iPad and iPad Pro uses the same size classes (Regular-Regular) for both orientations and in xcasset you can identify images eventually by their size classes or major device type (iPad vs iPhone vs watch) .
The only thing you can do is provide images a little bit bigger, or fix the size of image views and, instead, make some other elements with flexible width and height, such as space between images or the elements.
As pointed by Julian is worth to mention that is possible to detect the device type at runtime by inspecting UIDevice class properties and select the proper image at runtime. Apple do not support those methodology.
Related
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 would like to start my application that need to support for only iPad devices. Now, my question is do I need to use the Autolayout functionality?
What am thinking is as my app supports only iPad,no need to use the autolayout because all the ipad devices uses same size classes.
Correct me if am wrong.
You have to use size classes even if you are using only iPad device as target for your application. There are some reasons why you have to use the size classes :
1) iPad have diff screen sized and resolutions as well. check them Out here.
2) The iPad multitasking feature is there from ios 9 so you need to resize your views according to that and that will need size classes check it out here.
NOTE : if you are using autolayout then no need to use size classes but size classes are important you can check the importance of the size classes and its working in apple's design guide line (here)
ipad has different device size like 768 x 1024 and 1024 x 1366 (ipad pro) etc. so, you should use autolayout to manage it for every ipad device.
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!
We all are going to update our apps to iphone 6 and iphone 6 plus. That means we need to support 4 sizes.
1.) 3.5
2.) 4
3.) 4.7
4.) 5.5
Can we support all these screen sizes with single xib or storyboard ? also please share your views on how we can update our existing apps for iphone 6 and iphone 6 plus.
Yes. See Apple's iOS8 documentation specifically, size classes:
iOS 8 makes dealing with screen size and orientation much more versatile. It is easier than ever to create a single interface for your app that works well on both iPad and iPhone, adjusting to orientation changes and different screen sizes as needed. Design apps with a common interface and then customize them for different size classes. Adapt your user interface to the strengths of each form factor. You no longer need to create a specific iPad storyboard; instead target the appropriate size classes and tune your interface for the best experience.
There are two types of size classes in iOS 8: regular and compact. A regular size class denotes either a large amount of screen space, such as on an iPad, or a commonly adopted paradigm that provides the illusion of a large amount of screen space, such as scrolling on an iPhone. Every device is defined by a size class, both vertically and horizontally.
There is also a very good tutorial video on the WWDC site.
In order to stop your iPhone 6/6+ app being scaled, add a launch image of the correct size or better, use a launch storyboard.
From there you should use AutoLayout and avoid hard coding to screen sizes. In the long run it'll be a lot less effort and less error prone.
In existing projects you can use autoresizing or auto layout of xib files.. that support all 4 devices.
I have implement my projects using autoresizing to support all devices.
In Xcode 6, the way layout is done for devices of varying sizes has been changed somewhat: we now have Size Classes. But how can I lay an interface out for a 3.5-inch iPhone?
The "compact" height class doesn't seem to apply here. I understand I can change the constraint / compression resistance (etc) values, but in my case I want to be able to change the font size for this device size.
Is this completely impossible? I realize iOS 8 removes support for iPhone 4 (but not 4S). We also can't all target purely iOS 8, and need to support 7 and even 6.
There doesn't appear to be any way to use size classes to isolate a specific device size. I guess Apple didn't intend this feature to be used to build different layouts based solely on screen size, rather look at broader concepts, such as orientation and device type (iPhone, portrait or iPad, landscape). In other words "don't have different designs for iPhone 4/4s, 5/5c/5s or 6/6+"...
I have the exact same problem as the OP, in as much as I want a different layout only for 3.5" screens, but I ended up resorting to removing constraints and adjusting the layout programmatically, only for 3.5" screens.
iPhone 3.5 inches will have the following size classes:
Compact w Regular h - in portrait
Compact w Compact h - in landscape (unique for iPhone 3.5 inches)
So that is the only size classes you can use to manipulate for iPhone 3.5 inches.
It appears that some of the size classes do work with iOS 7 according to the link provided by '#Guillaume Algis' How can Xcode 6 adaptive UIs be backwards-compatible with iOS 7 and iOS 6?
However there is no info about their support in iOS 6 and still there are issues even with iOS 7.
If you really need to support iOS 6 and 7 and you are ok with the AutoLayout + multiple storyboards/xibs for different device idioms approach, than you can simply disable size classes for your storyboards/xibs using the File Inspector by unchecking "Use Size Classes" checkbox.