Block auto rotation?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
belgarion
Posts: 5
Joined: Fri Dec 10, 2010 9:42 pm

Block auto rotation?

Post by belgarion » Fri Dec 10, 2010 9:45 pm

Hi everyone,

I'm trying to force the iphone to saty in vertical (portrait) mode.
I want to block it from rotating and therefore adapating my app to the horizontal mode.
Is there any way to do it (or fake it) ?

Thank you all for your help !

AD

RickD
Posts: 31
Joined: Thu Feb 11, 2010 5:47 pm

Re: Block auto rotation?

Post by RickD » Fri Dec 10, 2010 10:38 pm

Hi belgarion:

Not a problem. What I do is include a "iphoneLockOrientation" command in my on openStack code and it will hold whatever default orientation you have selected under the Standalone Application Settings for iOS.

Works like a charm!

Cheers

belgarion
Posts: 5
Joined: Fri Dec 10, 2010 9:42 pm

Re: Block auto rotation?

Post by belgarion » Fri Dec 10, 2010 11:02 pm

Hey RickD !

Thanks a lot for your fast answer and great help !

Big Big Thanks ! :)

Beslgarion

observ3
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 34
Joined: Mon Oct 11, 2010 11:05 pm

Re: Block auto rotation?

Post by observ3 » Thu Dec 16, 2010 9:56 am

Thank you!!!
I hope that the iOS documentation is expanded soon... hopefully integrated into the dictionary.
Check out my LiveCode program, WriteSpire, on the App Store!

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Thu Jun 29, 2006 4:16 pm

Re: Block auto rotation?

Post by Randy Hengst » Fri Dec 17, 2010 5:01 am

Hi All,

I'm having trouble getting my app to stick in one orientation. Before I describe my problem would one of you try something for me and let me know what happens.... First, I understand you are making a app to work only in portrait mode, correct? If so, tell me what settings you used in the iOS Application Settings.... I assume Initial Orientation is set to portrait and Supported Orientations is set to portrait.

Now, hold your real device (I'm using an iPod Touch) in landscape mode and open your app.... what happens?

take care,
randy hengst

wsterdan
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 16
Joined: Sat Oct 30, 2010 2:57 am

Re: Block auto rotation?

Post by wsterdan » Fri Dec 17, 2010 5:57 am

I'm using Landscape and an iPad (rather than Portrait and an iPod) but it works perfectly, the app starts up on the device in Landscape and stays there, no matter what way I turn it.

-- Walt Sterdan

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Thu Jun 29, 2006 4:16 pm

Re: Block auto rotation?

Post by Randy Hengst » Fri Dec 17, 2010 2:54 pm

Hi Walt

Thank for your response.

What happens when you hold the iPad in portrait and open your app? I'm using iPod and want my app to only display in landscape right. When I open in portrait, the app shows in landscape right and then immediately rotates to portrait. In fact, when I open the app with the iPod held in any orientation other than landscape right, the app rotates immediately after opening.

I've set the start up and allowed orientations to landscape right.
I've placed iphoneLockOrientation in the openStack handler and in an on StartUp handler....

How have you set things up? I simply can't see what step I'm missing.

randy hengst

kevinmiller
Livecode Staff Member
Livecode Staff Member
Posts: 120
Joined: Thu Feb 23, 2006 7:57 pm

Re: Block auto rotation?

Post by kevinmiller » Fri Dec 17, 2010 6:10 pm

We've explained how to do this in more detail in the latest version of handbook (4.5.3-dp-1/rc-1). You need to use iphoneSetAllowedOrientations in a 'startup' handler.
Kevin Miller ~ kevin@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Thu Jun 29, 2006 4:16 pm

Re: Block auto rotation?

Post by Randy Hengst » Fri Dec 17, 2010 8:37 pm

Hi Kevin,

Yes, I know... my startup handler is in the stack script. Is that where it goes? The do not see in the docs where to put the handler.

on startup
iphoneSetAllowedOrientations "landscape right"
iphoneLockOrientation
end startup

I have tried the handler without the lock statement. I've tried to put both statements in the openStack handler. I've tried calling the startUp handler from the openStack handler.

I am working with the same stack that I submitted to Apple using 4.5.1 and the plugin version... the landscape worked and stuck using that version.

take care,
randy

wsterdan
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 16
Joined: Sat Oct 30, 2010 2:57 am

Re: Block auto rotation?

Post by wsterdan » Sat Dec 18, 2010 7:27 am

Randy Hengst wrote: What happens when you hold the iPad in portrait and open your app? I'm using iPod and want my app to only display in landscape right. When I open in portrait, the app shows in landscape right and then immediately rotates to portrait. In fact, when I open the app with the iPod held in any orientation other than landscape right, the app rotates immediately after opening.
As mentioned, I'm building a landscape app; if I open the app in portrait, the first image shows up correctly (landscape rotated, top of picture pointing to the left). Interestingly enough, under 4.5.2 (build 1150) the picture starts off scrunched, then fills the screen. The image is scrunched vertically (in relation to the picture, regardless of orientation) and immediately expands to fill the screen. It only lasts for a small fraction of a second, but It doesn't happen with any of the earlier builds.
-- Walt Sterdan

Post Reply

Return to “iOS Deployment”