Page 1 of 1

Portrait App - Add Landscape Rotation

Posted: Tue Jan 10, 2012 11:39 pm
by Tester2
I have an iPhone app that I have developed and put up on the App Store.

The app as is only supports a Portrait orientation.

I am looking to add the ability for the user to rotate the device and change the orientation to Landscape.

What is the easiest way to go about doing this? (What functions to use in scripts...when to use them, etc)

Thanks bunches!

-Tester2

Re: Portrait App - Add Landscape Rotation

Posted: Wed Nov 19, 2014 8:50 pm
by lohill
This seems like a pretty basic question. Is no one able to answer it? This is something I would like to be able to do.

As a side note, why would the following code be rejected with the message ( Can't find handler error near "mobileSetAllowedOrientations, char 1) in the OpenStack event.

Code: Select all

on openStack
  mobileSetAllowedOrientations "portrait,portrait upside down,landscape left,landscape right"
end openStack
I even tried it without the landscapes left and right just as the dictionary example and it was rejected. Also tried it in the OpenCard event with no luck.

Thanks,
Larry

Re: Portrait App - Add Landscape Rotation

Posted: Wed Nov 19, 2014 9:19 pm
by Dixie
Here is a simple example of 'orientation' ...
The handlers are in the stack script..:-)

Re: Portrait App - Add Landscape Rotation

Posted: Wed Nov 19, 2014 11:24 pm
by Simon
Hi Larry,
mobileSetAllowedOrientations is for mobile only... won't run on the desktop so you'll have to check the environment before you run it.

Simon

Re: Portrait App - Add Landscape Rotation

Posted: Thu Nov 20, 2014 12:18 am
by lohill
Thanks Dixie and Simon.

Regards,
Larry

Re: Portrait App - Add Landscape Rotation

Posted: Thu Nov 20, 2014 6:50 pm
by lohill
Very nice and very simple Dixie. My idea is to construct a set of flash cards where in portrait mode the problem will be displayed as:

7 (7 should be above the 9)
+ 9
---------

while in the landscape mode it will be

7 + 9 =

If I were to make two separate stacks (Stack1 and Stack2) where the first is played out in portrait order and the second in landscape order and made them so that they both contained the same numbers at any given time. Could I get away with using a 'resizeStack' like the one shown below:

Code: Select all

on resizeStack
   iphoneShowStatusBar
   
   if "portrait" is among the words of iphoneDeviceOrientation() then
     go to stack "Stack1"
      exit resizeStack
   end if
   
   if "landscape" is among the words of iphoneDeviceOrientation() then
      go to "Stack2"
      exit resizeStack
   end if
end resizeStack
That would seem a lot simpler than trying to put all the objects in the proper loc.

Larry

Re: Portrait App - Add Landscape Rotation

Posted: Thu Nov 20, 2014 9:22 pm
by Dixie
Larry...

I would just use the one card... have a look at the attached stack...
As it is set up, the numbers and the operator change each time the card is opened, but you could set it so that new numbers are provided after your 'student' has answered each question...:-)

Re: Portrait App - Add Landscape Rotation

Posted: Tue Nov 25, 2014 12:18 am
by lohill
Dixie,

If it is not too much trouble, I would sure like to know why the attached stack will not go to Landscape correctly. As you can see from the commented out lines I have tried the guts of the rotation in both resizeStack and orientationChanged. Also, the only functioning operation is addition.
Flash Cards.livecode.zip
(3.67 KiB) Downloaded 188 times
Thanks,
Larry

Re: Portrait App - Add Landscape Rotation

Posted: Tue Dec 02, 2014 12:19 am
by lohill
Well, I finally got it to work. I started with Dixie's orientate2 stack and slowly modified it by adding more buttons and objects to get it the way I wanted. It was a slow process because I tested and saved at regular intervals so as not to have to go back to the original in case I had problems. I still have yet to work out the details for the other operations and adjust the 'levels'.

Larry