Page 1 of 1
Giving Portrait App Ability to Use Landscape
Posted: Thu Jan 12, 2012 10:11 pm
by Tester2
I have an iPhone app that supports a Portrait orientation only.
I want the user to be able to rotate the device and change the orientation to Landscape.
What is the easiest way to go about making my app able to do this? (What functions to use in scripts...when to use them, etc)
I know there are certain functions (mobileOrientation) that let you trap what orientation the device is currently in. But then how do you make your app automatically respond to that orientation? Do you have two cards for each screen (portrait and landscape) and switch between the two?
Help is greatly needed and much appreciated.
Thanks bunches!
-Tester2
Re: Giving Portrait App Ability to Use Landscape
Posted: Thu Jan 12, 2012 10:50 pm
by Dixie
Tester2...
I have attached a stack that will allow you to rotate... It is a 'simple' example of rotation, only two handlers are used and you will find them in the card script. I would also suggest that you read page 25 of the iOS release notes....
be well
Dixie
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 7:04 pm
by SusanB
I am grateful for this, and it worked! I have to use both portrait and landscape orientations in my app and need it to open in portrait. Now when I go to the card that needs landscape, when I rotate the phone it miraculously goes to landscape orientation. The problem is it looks terribly confusing when it first appears in portrait orientation. This is probably a ridiculous question, but is there something that can be done so that card automatically opens in the needed landscape orientation??
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 7:24 pm
by Dixie
SusanB...
The card that you want to have open in 'landscape' mode... do you want it to stay locked in in landscape mode all the time that you are on that card ?
be well
Dixie
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 7:32 pm
by SusanB
Yes, it is worthless in portrait!
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 7:39 pm
by Dixie
susanB...
Have a look at page 27 of the iOS release notes, 'Controlling auto-rotation'... read about 'iphoneLockOrientation' and 'iphoneUnlockOrientation'. I would lock the orientation in a preOpenCard handler when you go to the 'landscape' card and then unlock the orientation in a closeCard handler of the card...
be well
Dixie
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 7:58 pm
by SusanB
I knew you would point me to the release notes, and now I must confess my most humble ignorance as to where to find the release notes

I've searched high and low, and I'm sure I've read them. Are they from the Apple Developer site or the RunRev site? Please excuse my cluelessness, and my deep thankfulness for your help.
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 8:02 pm
by Dixie
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 8:06 pm
by SusanB
Bless you! I've been there before, obviously, but my foggy brain has trouble remembering where to go. Now it's bookmarked.
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 9:22 pm
by Klaus
Hi Susan,
SusanB wrote:I knew you would point me to the release notes, and now I must confess my most humble ignorance as to where to find the release notes

I've searched high and low, and I'm sure I've read them. Are they from the Apple Developer site or the RunRev site? Please excuse my cluelessness, and my deep thankfulness for your help.
in LiveCode: Menu: Help -> iOS Release Notes
Best
Klaus
Re: Giving Portrait App Ability to Use Landscape
Posted: Fri Apr 27, 2012 9:31 pm
by Dixie
Klaus wrote:in LiveCode: Menu: Help -> iOS Release Notes
Of course... how stupid of me...

Re: Giving Portrait App Ability to Use Landscape
Posted: Sat Apr 28, 2012 3:01 am
by SusanB
Oh no, it's me again. (Now I remember having gone to the menu to find those release notes in the past....) The thing about getting in landscape orientation, is that it doesn't happen until you've tilted your device in that direction, right? So if you go to the card from being in portrait, it will still be in portrait until you rotate the device. Is there a way in preopencard to make it think you've rotated it to landscape before you actually do? I've tried to figure how to do that and just can't get it. Setting the stack dimensions to do that on preopencard works in development, but not on the device.
Re: Giving Portrait App Ability to Use Landscape
Posted: Sat Apr 28, 2012 4:45 am
by Dixie
SusanB...
I don't really know what you want to accomplish, but have a look at this stack... I have just modified the one that was posted earlier in the thread. When the card first opens it is in portrait mode... when you rotate to landscape it displays a picture... a group is just hidden or shown depending on the orientation... maybe this will work for you...
be well
Dixie
Re: Giving Portrait App Ability to Use Landscape
Posted: Sat Apr 28, 2012 7:43 am
by SusanB
Dixie,
You gave me a great idea for a workaround. I see the light at the end of the tunnel. Thanks!
Re: Giving Portrait App Ability to Use Landscape
Posted: Sat Apr 28, 2012 7:35 pm
by SusanB
One last comment. Dixie: I am so thankful for your help. Now my problem is solved. All the knowledgable people who so generously share their expertise on this forum are my heroes. Maybe one day I can be of help, too. Say, if someone wants to know what a button is or something
