Landscape orientation on iPad results in flickering

I checked out the console on Xcode  (thanks for pointing this out!) and I see that the orientation event is fired multiple times spontaneously. The orientation type is either " landscapeLeft" or " faceUp" as reported on the console.

The device is on my desk, slightly tilted, one of the long sides held up by the roll-up smart cover. 

But here is something interesting: When I manually hold up the opposite side, no orientation events are fired and there is no flickering!

So now I’m confused. I need the orientation event because I have two background images (horizontal and vertical). The layout of buttons and form fields are also adjusted for orientation.

How do I deal with these two spontaneous orientation events? Why are they even firing when the device is lying still?  

Without seeing your orientation code, it’s hard to advise, but if you don’t care about the faceUp event, just throw it away.  As to why it fires with the ipad still, maybe it’s an initial setup or something.

I’ve only used it in one app and  was only look for portraitUpsideDown in it and I never noticed it firing off. 

Rob

The orientation code is still the same as listed above in the spash.lua file. (After watching your excellent Reloading Storyboard Scenes video tutorial several times I tried the orientation code out of the willEnterScene and enterScene functions but that didn’t help in my case).

I actually tried ignoring the faceUp orientation by adding to the code:

elseif system.orientation == "faceUp"

    – do nothing

else …

but this resulted in my background image disappearing altogether.

I wonder if it’s possible to handle the faceUp event by doing a full 180° rotation of the scene, forcing the user to rotate the device? :slight_smile: But I guess not…

Leonardo

I think the best thing to do here to narrow this down is:

  1. make a small example of what you are doing, but keep it contained to a main.lua file and do not use storyboard.

  2. add in your orientation stuff.

  3. see if the issue still occurs.

If the issue still occurs after step 3, then post up the full code to the test version and we will then know if you are doing something wrong or if there is a corona bug that you have found.

I think this would help everyone and save a lot of back and forth.

Thanks!

Ok Danny, I can confirm that the issue is there with the bare minimum of code.

All you need to do is:

  1. Lay the iPad flat on the desk, slightly tilted wide side up, using the smart cover

  2. Start the app and watch the Xcode console.

  3. A tap on the screen is enough to trigger a series of rotation events of type faceUp and landscapeLeft , and occasionally portrait.

config.lua:

[LUA]

application = 

{

    content =

    {

        width = 768,

        height = 1024,

        scale = “letterbox”,

        xalign = “center”,

        yalign = “center”,

        imageSuffix = 

        {

            ["@2"] = 2,

            ["@4"] = 4

        }

    }

}

[/LUA]

main.lua:

[LUA]


– main.lua


– Your code here

local function onOrientationChange( event )

    local currentOrientation = event.type

    print( "Current orientation: " … currentOrientation )

end

Runtime:addEventListener( “orientation”, onOrientationChange )

[/LUA]

Version 2.0.0

Build: 2013.1202

Please let me know if I need to do a bug report.

Thanks!

I just tried your code with the latest Graphics 2.0 build and I’m seeing the same issue.  Please file a bug report and post the bug report number back to this thread.

Thanks

Rob

A bug report has been filed for this issue:

(Case 27672) Spontaneous and random firing of orientationChange event on iPad

I thought I was loosing my mind. I have had exactly the same issue for a couple of weeks on a business app I am working on.

Has there been any progress or resolution on this ?

Has there been any update on this vital issue

I thought I was loosing my mind. I have had exactly the same issue for a couple of weeks on a business app I am working on.

Has there been any progress or resolution on this ?

Still no news on this ? Interestingly case 27672 doesnt even appear on FogBugz

Bug #27672 is in Fogbuz.  Only staff members can look up bugs by other people.

For this bug, it was closed with this response:  Corona reports the orientation events from the OS so if you are getting edge-case events, it’s from the OS and not Corona. Most apps would ignore a Faceup orientation, which you can do in your event handler.

So basically we just pass what we get from the OS on.  It’s the programmer’s responsibility to handle the events as they see fit.  Yes, it’s a weird bug.  I tested the code and got the same response, but since it’s coming from the OS, you will just need to program around it.

Rob

I used a Gysroscope app on my iPod laid on top of my iPad to figure
out the point where it flickers. I had not noticed that we have a
gyroscope event; good to know!

I have a timer on one scene but it’s only triggered by user input
(after tapping on a button). In my stripped down test this scene was not
in the project.

Has there been any update on this vital issue

Still no news on this ? Interestingly case 27672 doesnt even appear on FogBugz

Bug #27672 is in Fogbuz.  Only staff members can look up bugs by other people.

For this bug, it was closed with this response:  Corona reports the orientation events from the OS so if you are getting edge-case events, it’s from the OS and not Corona. Most apps would ignore a Faceup orientation, which you can do in your event handler.

So basically we just pass what we get from the OS on.  It’s the programmer’s responsibility to handle the events as they see fit.  Yes, it’s a weird bug.  I tested the code and got the same response, but since it’s coming from the OS, you will just need to program around it.

Rob

I used a Gysroscope app on my iPod laid on top of my iPad to figure
out the point where it flickers. I had not noticed that we have a
gyroscope event; good to know!

I have a timer on one scene but it’s only triggered by user input
(after tapping on a button). In my stripped down test this scene was not
in the project.