Distinct UITableViewCell / UICollectionViewCell metrics between iPhone 6 Plus and all other smaller screens - ios

I have an iOS app that currently supports all screen sizes of iPhone and iPod touch (but not iPad), only in portrait orientation. The app supports iOS 7 and newer. My visual designer suggested increasing some metrics within certain UITableViewCell and UICollectionViewCell instances when displaying on the iPhone 6 Plus. For example, the image cell that shows an icon or a contact photo will be about 25% larger (by points) only on iPhone 6 Plus.
After reading this Adaptive Size Design article at apple.com, I see that iPhone 6 Plus does not have a distinct size class from smaller screen devices when in portrait orientation. Does this mean that I should detect the screen resolution and handle the iPhone 6 Plus-specific metrics in code instead of the xib? Or is there a way to handle this in the xib that I haven't come across yet?
In code, I could easily specify an alternate xib to load for iPhone 6 Plus, but would prefer to only have one xib to support all screen sizes and scale factors. This app might support iPads in the future, but not right now.

Yes: if you wish to display a distinct UI on the 6+ in portrait, you're going to have to do it programmatically, either by using UIScreen or UIDevice to identify when you're running on that hardware.

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

Removing launch screen file from Info.plist scales the views

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.

Launch screen storyboard for multiple devices and different orientations in iOS

My application supports all devices from 4 inch onwards in both orientations.
iPhone - 5, 5S, 5C, 6, 6S, 6+, 6S+, SE
iPad 4, iPad Air, iPad Air2, iPad Pro etc
Using asset catalog for launch screen its working fine but in iPad Pro app displays standard keyboard rather iPad Pro optimized keyboard which is bigger and doesn't give best user feel.
As per below link app should be using launch storyboard rather than asset images to get optimized iPad Pro native keyboard.
https://forums.developer.apple.com/thread/26357
Now question is how to support both orientations during launch screen storyboard ?
How to add different launch images for portrait and landscape modes in storyboard ? Using size class for iPad in both orientations its both Regular and Regular size.
Note - Because it launches a screen storyboard, one can't customize the size class with custom class.
In your launchsScreen.storyboard add imageView and set it's four constraints like : top,bottom,leading,trailing.
Now, in your assets add separate images for iPhone and iPad with 1x,2x,3x resolution for iPhone and 1x,2x for iPad.
And set that image to that imageview. It will manage then for every device!
You can set different images for different size class in assets. So for different orientation you can set different images in assets.
refer Apple documentation for more details.
And yes you can use vector graphics as suggested in comment by #pkc456 to keep your app light weight.

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.

Do you have to use Size Classes if you are developing for iPhone only?

I understand the role of auto-layout but if I am developing for iPhone devices only, should I still use size classes? From my understanding, size classes are extremely useful if I am developing for iPad as well, in my case I am not. Would the more sensible option be to use size classes but just use COMPACT WIDTH | REGULAR HEIGHT ?? Or should I not use size classes and just build my app using auto-layout?
There are two situations where size classes are useful in the iPhone development:
If you want to support landscape and portrait and want to have different constraints in different orientations and even hiding/showing different vies.
If you want to do a SPECIFIC layout for iPhone 6+ in LANDSCAPE
If you don't want these two conditions, you can ignore size classes them or disabling them.
For more information on the differentiation you can have with the current devices check out this link.
The problem with iphone is that there 4 sizes of iphone in the market right now.
Iphone 6 Iphone 6 Plus Iphone 5 Iphone 4
Using COMPACT WIDTH | REGULAR HEIGHT will limit your option when you rotate your device
iphone 6 iphone 5 and iphone 4 when rotated ->
COMPACT WIDTH | COMPACT HEIGHT
Therefore I would rather recommend you to code in ANY WIDTH|ANYHEIGHT so it is more compatible to any UI SIZE
*note size classes is useful when implementing extra buttons in different UI
ie. suppose you create an calculator app, in an iPad it can fit extra button while in iphone you can't . so you use size classes to make sure you share the same codebase
source CS193p, stanford IOS 8 course

Resources