Page 1 of 1

Coding for both orientations

Posted: Sun Jan 02, 2011 11:18 pm
by richardmac
I've got an iPad app designed for one orientation (landscape) and when you turn the iPad to portrait, 30% of my graphics get cut off and the bottom of my graphic ends and shows a big empty white space. Rather than try to lock it down, I'm wondering which of the following two approaches is the best idea:

1. Use scripting to change the location of the graphisc and fields and buttons when the orientation is changed, or

2. Just extend the graphic out and sort of live with it not looking as good in portrait orientation.

Anyone looked at the best way to handle this yet?

Re: Coding for both orientations

Posted: Mon Jan 03, 2011 6:29 am
by Janschenkel
I would go for option 1: script react to orientation changes, and move everything over to the best new location/size.
Unless the user interface just doesn't fit in the other orientation, you shouldn't lock the user into it.
Always design for the medium at hand...

Jan Schenkel.

Re: Coding for both orientations

Posted: Wed Jan 05, 2011 8:25 pm
by RickD
Hi richardmac,

A third option is to put all your logic into a separate substack and create two cards (one for portrait and one for landscape).
Then use the orientationChanged message to switch between cards.

I use it and it works quite well.

Re: Coding for both orientations

Posted: Thu Jan 06, 2011 8:04 pm
by richardmac
That's a great idea. Could you maybe use this idea to have different screens for different hardware? On startup of the stack, you could check to see what the environment was, then switch to the appropriate card.

Re: Coding for both orientations

Posted: Sat Jan 08, 2011 1:14 am
by hliljegren
richardmac wrote:That's a great idea. Could you maybe use this idea to have different screens for different hardware? On startup of the stack, you could check to see what the environment was, then switch to the appropriate card.
Yes you can! I've tried this and it works great. I made a sub-stack for iPhone, one for iPhone Retina, one for iPad, but haven't yet made different cards for different orientations, but I would definitely go for a two card approach.

Re: Coding for both orientations

Posted: Wed Jan 19, 2011 6:44 pm
by andyh1234
Just to add, if you do set up two cards, make sure the orientationChanged message is at the card level, and not stack level.

Ive just spent 'a while' with my layout whirling round as the stack was getting so many orientationChanged messages, but when I moved them onto the appropriate cards all is now ok!