native.newWebView and orientation changes

Hey gang… I’ve seen the other post about the native webView, but only one guy seemed to be dealing with this, and it was not really pertinent to that thread, so I am starting a fresh one here specifically to orientation.

I’m trying to find the best way to handle all full screen orientation change of the native.newWebView without redrawing and resubmitting the request.

Below is my function that is handling the orientation change, which works properly, but I can’t seem to get the webview to resize properly. It just wants to shrink and resize improperly each subsequent orientation change.

Any ideas on how to accomplish this? I want to have a full screen webview that is able to change orientation and keep my url request session live.

[lua]local function onOrientationChange(event)
direction = event.type
delta = event.delta

–RESET GLOBAL WIDTH/HEIGHT
_W = display.contentWidth
_H = display.contentHeight

–ROTATE WEBVIEW
if direction == “portrait” then
–ROTATE TEXT ENTRY FIELD
if serverFieldPresent then
defaultField.x = _W * .5
–ROTATE INSTRUCTIONS
instruction.x = _W * .5

end

–SET bkg
bkg:setReferencePoint( display.CenterReferencePoint )
bkg.x = _W * .5
bkg.y = _H * .5
bkg.width = _W
bkg.height = _H

if webViewPresent then
print("Screen Height is " … _H)
–print("Webview is " … direction … " :: Delta is: " … delta)
webView.rotation = 0
webView.width = _W
webView.height = _H
end

elseif direction == “portraitUpsideDown” then
–ROTATE TEXT ENTRY FIELD
if serverFieldPresent then
defaultField.x = _W * .5
–ROTATE INSTRUCTIONS
instruction.x = _W * .5

end

–SET bkg
bkg:setReferencePoint( display.CenterReferencePoint )
bkg.x = _W * .5
bkg.y = _H * .5
bkg.width = _W
bkg.height = _H

if webViewPresent then
print("Screen Height is " … _H)
–print("Webview is " … direction … " :: Delta is: " … delta)
webView.rotation = 0
webView.width = _W
webView.height = _H
end

elseif direction == “landscapeLeft” then
–ROTATE TEXT ENTRY FIELD
if serverFieldPresent then
defaultField.x = _H * .5
–ROTATE INSTRUCTIONS
instruction.x = _H * .5

end

–SET bkg
bkg:setReferencePoint( display.CenterReferencePoint )
bkg.x = _H * .5
bkg.y = _W * .5
bkg.width = _H
bkg.height = _W

if webViewPresent then
print("Screen Height is " … _H)
–print("Webview is " … direction … " :: Delta is: " … delta)
webView.rotation = 0
print("Screen Height is " … _H)
webView.width = _W
webView.height = _H
end

elseif direction == “landscapeRight” then
–ROTATE TEXT ENTRY FIELD
if serverFieldPresent then
defaultField.x = _H * .5
–ROTATE INSTRUCTIONS
instruction.x = _H * .5

end

–SET bkg
bkg:setReferencePoint( display.CenterReferencePoint )
bkg.x = _H * .5
bkg.y = _W * .5
bkg.width = _H
bkg.height = _W
if webViewPresent then
print("Screen Height is " … _H)
–print("Webview is " … direction … " :: Delta is: " … delta)
print("Screen Height is " … _H)
–print("Webview is " … direction … " :: Delta is: " … delta)
webView.rotation = 0
print("Screen Height is " … _H)
webView.width = _W
webView.height = _H
end
end
end[/lua] [import]uid: 10361 topic_id: 30706 reply_id: 330706[/import]

I as well am trying to figure out this issue and am coming across the exact same error. I am guessing the webview doesn’t support changing width and height without removing it first… It makes the webview start to act very screwy. [import]uid: 19620 topic_id: 30706 reply_id: 144465[/import]

I as well am trying to figure out this issue and am coming across the exact same error. I am guessing the webview doesn’t support changing width and height without removing it first… It makes the webview start to act very screwy. [import]uid: 19620 topic_id: 30706 reply_id: 144465[/import]

I as well am trying to figure out this issue and am coming across the exact same error. I am guessing the webview doesn’t support changing width and height without removing it first… It makes the webview start to act very screwy. [import]uid: 19620 topic_id: 30706 reply_id: 144465[/import]

I as well am trying to figure out this issue and am coming across the exact same error. I am guessing the webview doesn’t support changing width and height without removing it first… It makes the webview start to act very screwy. [import]uid: 19620 topic_id: 30706 reply_id: 144465[/import]

I am facing the same issue. It seems that, on every rotation, one of the dimensions is always half the size it was before. So after going from portrait to landscape to portrait again, the width is now half the width it should be. And it keeps on shrinking on every orientation change.

I am facing the same issue. It seems that, on every rotation, one of the dimensions is always half the size it was before. So after going from portrait to landscape to portrait again, the width is now half the width it should be. And it keeps on shrinking on every orientation change.

Any luck on the webview resizing issue?

Any luck on the webview resizing issue?