Our DNA is written in Swift
Jump

iPhone Downsizing

I admit it, I belong to the group of people who use their iPhone singlehandedly. That is, a single-thumb-typer. Also, I scoffed at the idea of a super-sized iPhone 6+. But I am somebody to apply the scientific method for examine the validity of your own beliefs. So I purchased and used an iPhone 6+ (Gold, 128 GB) for almost 2 months. Here’s my verdict as well as an intro do size classes.

Ad

My iPhone 6+ evaluation started on October 7th when I unboxed it. I had been making fun of people who made phone calls with Samsung tablets at their ear, now I had become one of these ridiculous people myself.

The main reason for me wanting to try it out was that I wanted to see how it handles. The second main reason was that I wanted to see the optical image stabilisation first hand. On the latter I can say that it is quite brilliant as you can see in this test video which I shot from a moving car. Look at how the dirt and sports on the windshield are moving while the UFO moves very little.

From a usability point-of-view the iPhone 6+ turned out to be painfully large. I do not have small hands, but I cannot reach the top left keyboard buttons when thumb-typing while holding the iPhone cradled between the base of my thumb and the opposing fingers. That turned out to be a deal-breaker for me. You do get used to having more screen real estate to an extent that every time I picked up my 5S (which I kept for running) it felt tiny to me.

Temperatures dropped and so I went running with my iPhone 6+ in a pocket of my running jacket. There I found another weak point of the device. You can ruin the optical image stabiliser. After a single run I would no longer be able to take sharp pictures, because the motion-stabiliser would go vibrating around like crazy. It might just be a coincidence but this experience causes me to strongly advice against taking the iPhone 6+ for running. So I bought Apple Care and got it exchanged.

Using the iPhone should not be painful and cause you to fear for it. So I exchanged it for an iPhone 6.

The iPhone 6 is still slightly larger than the 5S, but within reason. I can still thumb-type as I was able to. And the optical motion-stabilization would be nice, but in practical use you rarely miss it. How often do you type versus how often do you film?

Size Classes and Orientation Deprecation

iOS 8 added something nice to support so many different device sizes: Size Classes. When enabled you can lay out your universal app UI in a single story board. The size classes have a horizontal and a vertical component that gets adjusted by the system based on the device orientation.

Size Classes

As you can see the iPhones have Compact/Regular in portrait and Compact/Compact in landscape orientation. With one notable exception. In landscape, the iPhone 6+ has a regular size class. This is the reason why it shows more UI on the springboard and the mail app.

You can see this for yourself by creating a new single-view app and adding this code to the ViewController:

- (void)viewWillAppear:(BOOL)animated
{
   [super viewWillAppear:animated];
 
   NSLog(@"%@", self.traitCollection);
}
 
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection 
              withTransitionCoordinator:(id)coordinator
{
   NSLog(@"%@", newCollection);
}

This code logs the trait collection when the view appears as well as whenever it changes, due to you rotating the device. A word of warning: the willTransition… is only called on view controllers if the trait collection actually changes. So on iPads – since both size classes are always regular regardless of device orientation – you never get this call. For this purpose there is a second new method:

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator
{
   [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
 
   [coordinator animateAlongsideTransition:^(id context) {
      // implicit animations to be in sync with transition
   } completion:^(id context) {
      // code after size change
   }];
}

Another word of warning: as soon as you implement this method, iOS will no longer call the willRotateToInterfaceOrientation:duration: method on which we have relied for many years. Apple wants to tell you something with this: you should no longer care about interfaceOrientation. In fact – if you set the deployment target to 8.0 or higher – all these rotation methods and property will be warned about as being deprecated.

There are however still some cases where device orientation matters, or where you might want to keep backwards compatibility. One scenario I encountered is when dealing with setting the video orientation on a video preview layer. I needed to do this on the barcode scanner I built for the ProductLayer SDK.

The only workaround I found was to use the application status bar orientation instead.

- (void)viewDidLayoutSubviews
{
   [super viewDidLayoutSubviews];
 
   // using size classes does not send the willRotate... 
   // any more, so we need to updated here
   UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
   [self _updateConnectionsForInterfaceOrientation:orientation];
}

Having to resort to this worries me a bit, because there might be situations where the status bar orientation is not getting updated or be UIInterfaceOrientationUnknown. In my tests so far I found no negative side effects, if you know of any please let me know.

If you have the luxury of being able to require iOS 8 you can click together wonderful interfaces in IB. You can specify which views should appear and which layout constraints should apply in which combination of size classes. The following two screenshots are from such a single-storyboard app I am developing for prod.ly.

Hungry Scanner Landscape  Hungry Scanner Portrait

Note how the large round buttons move to where there’s space in the UI. This took me a day to figure out. But now that I know how to use this I would never do it in code in the future.

There are still a few bugs in size classes. I reported one earlier when using the new popover presentation which automatically presents a view controller either modally or in a popover. But if you stick to the normal modal presentation segues you should be fine.

Conclusion

Size classes are shaking up the previous way we did interface orientation. If you want to use the goodness of a single storyboard for all devices you have to require iOS 8. Having built an entire app on that I can say that this is truly awesome.

When implementing adaptive user interfaces be sure to test on multiple size simulators and – where possible – also on the 6+. But do you really need an iPhone 6+ as your main carry phone? I don’t think I do, as the iPhone 6+ simulator supports size classes just the same as the hardware. In my opinion the iPhone 6 represents the ideal sweet spot.


Categories: Apple, Recipes

Leave a Comment

%d bloggers like this: