device orientation

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mmiele
Posts: 55
Joined: Sun Jan 21, 2007 1:25 pm
Location: Naples, Italy

device orientation

Post by mmiele » Fri Feb 04, 2011 12:37 am

I need a stack where a card must be seen in portrait orientation and another in landscape orientation.

Is there a way to set the interface orientation of a card (iphoneOrientation prop) independently of the current device orientation (iphoneDeviceOrientation prop)?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: device orientation

Post by BvG » Fri Feb 04, 2011 12:58 pm

As with SQL and XML, RunRev decided to simply port the pre-existing C functionality one-to-one into LC, producing an almost unusable mess. But you should be able to cobble something together by using these facts:

orientationChanged is sent before anything happens to the orientation
iphoneLockOrientation keeps the current orientation of the stack/card, no matter what the iphoneDeviceOrientation changes to.
iphoneLock- and iphoneUnlockOrientation work like lock screen and unlock screen.
when the autorotation actually happens, it checks the iphoneSetAllowedOrientations, which is on startup what you did set in the standalone builder.

So one way to do it would be:

Code: Select all

on opencard
  if the short name of this card = "mode1" then
    iphoneSetAllowedOrientations "portrait,portrait upside down" --only upside
  if the short name of this card = "mode2" then
    iphoneSetAllowedOrientations "landscape left,landscape right" --only widescreen
  end if
end opencard
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

mmiele
Posts: 55
Joined: Sun Jan 21, 2007 1:25 pm
Location: Naples, Italy

Re: device orientation

Post by mmiele » Fri Feb 04, 2011 3:15 pm

My problem is:
  • starting from a landscape oriented iPhone, with a landscape oriented card
  • arriving to a landscape oriented iPhone (the device is not rotated) but with a portrait oriented card (the image is rotated)
In other words I want to be sure that when I visit some particular card, the card orientation is always "portrait" and doesn't depend on the device orientation.

Post Reply

Return to “iOS Deployment”