Orientation Change Issue

Hi,
I am facing the similar issue while running my app in both orientation.
I have printed the event.type and system.orientation in my orientation change function and it’s working on simulator but when i am checking consolelog in xcode it does not print anything, though the orientation is happening.
That does not matter for me, The actual problem is when i am using my app on device some times, my screen is displaying half(It happens only in portrait mode).
So i want to know the exact reason.
I am stuck here for last couple of days.
I am using corona version : 1134
Please help.
  
Here is my orientation function:
<lua>
function onOrientationChange( event )  
    print(“orientation change==”…event.type)
    
    print(“in orientation change function=”…system.orientation)
    
    if system.orientation == “portrait” or system.orientation == “portraitUpsideDown” then
        _G.port = 0
        displayText()
    else
        _G.port = 1
        displayText()
    end
end    
 
Runtime:addEventListener(“orientation”, onOrientationChange )
</lua>

Here is my screen shot:

When it displays ‘half’ like this, the device is in portrait mode but your app is rendering the content thinking that the device is in landscape.  If you rotate your device to landscape, wait a second, and then rotate it back to portrait, does it then render the content in portrait mode correctly?

If it does, then it sounds like you have the exact same issue as the original poster, in which case I would think the approach that I described earlier in this thread would work.  It’s important that you implement the approach I wrote exactly as I wrote it.  You need to store system.orientation into a separate variable (which I called deviceOrientation) in your main.lua, and use this to compare against the event.orientation in the orientation listener.

  • Andrew

Thanks aukStudios,
I did the same but didn’t success. I think i got the issue now. When I am using crawl space library in my project then it does not detect system.orientation and when I removed the crawl space library from my code it does detect system.orientation. Is there any alternative of crawl space library?
Can anyone tell me why it happens?
Any help will be appreciated.
Thanks,