This is related to a previous post, http://developer.coronalabs.com/forum/2012/07/20/newwebview-has-unwanted-left-margin , in which I determined that removing config.lua could make my newWebView behave properly on iPad 2.
Now I’m working on making the app perform across multiple platforms (iPod 4, iPhone, iPhone Retina, iPad, iPad Retina) and have come across another concern with newWebView. When I got the app working on iPod 4 today, I noticed that the webview was much larger than the screen, even though I’d deleted config.lua and I’d specified the dimensions to be display.contentWidth and display.contentHeight (minus the height of the navigation buttons at the bottom of the screen).
After pondering it over some chicken wings and beer, it occurred to me that the iPod 4 is a Retina device. On a hunch, I added a couple lines of code:
[lua] if(display.contentWidth == 640) or (display.contentWidth == 1536) then – iPod/iPad Retina
tmpPopup = native.newWebView(0, 0, display.contentWidth / 2, display.contentHeight / 2 - (returnx.height) / 2)
else
tmpPopup = native.newWebView(0, 0, display.contentWidth, display.contentHeight - (returnx.height))
end[/lua]
…and sure enough, after I deployed it to the iPod, it looked perfect.
So, that’s working, but I don’t understand why it’s behaving this way when, if I set the dimensions of a newImageRect (for example), it uses the dimensions I specify. Is there some guide to which graphic elements use the dimensions given, and which elements “interpret” the given dimensions according to other criteria?
[import]uid: 117162 topic_id: 29143 reply_id: 329143[/import]