noway
noway

Reputation: 2585

phonegap 2.2 orientation change does not resize app

I didn't have this problem on previous versions of Phonegap. But in 2.2, when I change the orientation, it doesn't update the uiwebview.

Does phonegap not support landscape view by default? How do you handle this?

problem

Upvotes: 20

Views: 8174

Answers (4)

user3560185
user3560185

Reputation: 21

window.addEventListener(
    "orientationchange",
    function() {
        // Announce the new orientation number
        location.reload();
    }, false );

Upvotes: 2

user859952
user859952

Reputation:

I have also have same issue in ios phonegap ....

Just go and update x-code project file (IOS Application target ) change or update support interface orientation and check it all orientation .

it's work well ...

Upvotes: 3

Adam Lockhart
Adam Lockhart

Reputation: 1195

To add to Stephan's answer, if you need to do anything special when the orientation changes, you can set a callback function to:

window.onorientationchange

Upvotes: 4

This is not an issue with the WebView getting updated but with the meta tag in the index.html's document head.

<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

After removing the unnecessary height=device-height everything works just fine

<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, target-densitydpi=device-dpi" />

landscape is supported

Upvotes: 50

Related Questions