UX in Bed

August 21st, 2009

One of the questions I ask when working on a new project is, “Where will people use this?”

The question is obvious for mobile projects because highly variable environments are par for the course. It matters with all non-stationary touch points, though – from door handles on train cars to Android applications to the work we’ll surely be seeing from the new Schematic Touch group.

Asking the question is easy. Using the response may not be. I see mobile apps all the time that are clearly made for users who are stationary, physically stable, connected to a consistent network, and with both hands free for interaction. High demands, right? They conflict with my more common usage patterns, and those apps rarely get launched.

A great example of a more subtle conflict – and one being addressed without much fanfare by many app developers – is iPhone usage in bed and auto-rotation.

Welcome to My Boudoir

My wife and I are incredibly lame. We tend to lie, side by side, reading news on our iPhones before falling asleep at night.

Apps that auto-rotate when the device orientation changes suck in bed. Or on the couch. Or in a reclining seat in first class. Or in a hammock. You get the point.

The problem is that we all flip-flop all over the place in bed (va-va-va-voom!), changing the point of reference for orientation. What makes a lot of sense when we’re upright is a pain in the ass when we’re horizontal.

A Suggestion

I’d like to encourage developers to carefully consider auto-rotation. A lot of devs are starting to catch on to this one as customers complain or make feature suggestions. I thought I might provide an example illustrating a really easy approach to disabling auto-rotation globally in an app. There are more sophisticated and pattern-y ways for the clever.

Don’t get me wrong – auto-rotation can be a great feature. I am all for it. But I have decided the baseline rule should be: If your views auto-rotate, you should provide a (preferably in-app) preference for disabling the feature.

An Example

So how does a developer do that?

Well, the interface is up to you. Let’s assume you have a project with a button that brings up an in-app settings screen.

If you have a UISwitch in there that represents the global auto-rotation state, just save it to the user defaults when you close the settings.

- (IBAction) dismiss:(id)sender
{
	// Update the defaults.
	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	BOOL autoRotationEnabled = self.autoRotationSwitch.on;
	[defaults setBool:autoRotationEnabled forKey:kAutoRotateKey];
	[defaults synchronize];

	// Close!
	[self.parentViewController dismissModalViewControllerAnimated:YES];
}

In your app delegate, declare a method to get the current global auto-rotation value.

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return [[NSUserDefaults standardUserDefaults] boolForKey:kAutoRotateKey];
}

Finally, in each view controller that should obey the globals, ask the app delegate for the scoop.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	PillowTalkAppDelegate *appDelegate = (PillowTalkAppDelegate *)[UIApplication sharedApplication].delegate;
	return ([appDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]);
}

Here is a quickie example project that illustrates the concept: PillowTalk.zip

  • VB Dude
    Thanks for the post -- it was quite informative. However, I would add a few extra steps if one was trying to include this functionality in their code:

    1) Be sure to import your app delegate's header file in each view controller. For this example, it would be
    #import "PillowTalkAppDelegate.h"

    2) Also be sure to include the declaration of the shouldAutorotateToInterfaceOrientation function in your app delegates .h file. For this example, it would be
    - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
  • ra8

    Wish Apple had thought of this with iPhone’s Mail app: http://bit.ly/1rPsNc

    #iphonedev


    This comment was originally posted on Twitter

  • “If your views auto-rotate, you should provide a (preferably in-app) preference for disabling the feature.” http://bit.ly/2VEi3O #iphonedev


    This comment was originally posted on Twitter

  • UX in Bed http://bit.ly/kV3gu


    This comment was originally posted on Twitter

  • Please, please get the word out on this!
    I wish it was a universal setting that you could just disable it for every app in the phone settings. Until then, developers really should consider implementing it. It's so easy to do.
  • Yeah, Bill, that app does it very well. The example I provided is about the simplest you could ever do. Maybe it's worth coming up with a standard pattern and control set for this.
  • I absolutely can not *stand* autorotate.
    Second is "shake" .. shake to undo, shake to erase... shake to change. STOP IT.

    If you have to do this sh!t, please at least give me an option to disable it. Those apps that already provided forced portrait/landscape -- YAY. thank you.

    Auto rotation sucks.

    Scott
    ps: Yes, I use my iphone lying down, in bed upside down, etc.
  • With you all the way. Amazon's Kindle app for iPhone handles this very elegantly, and I use it often. Every time device orientation changes, a little unlocked padlock icon appears briefly in the lower right-hand corner of the screen. Tap the icon and it locks into the current orientation. Roll around as much as you want, and it ain't going anywhere until you tap it again to make it unlocked. Slick, easy, intuitive, useful, and smartly aware of the incredibly common "I'm reading in bed and I might just roll over" use case.
  • Adam French
    Amen. And I think the first and foremost app that should follow your lead is Safari. Secondly Mail, but mainly Safari.
  • UX in Bed (aka, auto-rotation on the iPhone can be sucky): http://bit.ly/1rPsNc


    This comment was originally posted on Twitter

blog comments powered by Disqus