native.showWebPopup problem on iOS iPhone only

Hi,

I am having trouble with simple local web page using native.showWebPopup (only on iPhone).

First, I am using Corona SDK 2012.799 on Mac.

I have a simple webpage with some centered text and a link (anchor) with an image (next you’ll see the HTML code).

I am also using the <meta name=“viewport” …> tag to comply with mobile web specs.

The web page should show a centered text and an image button (centered) that will take you to http://m.twitter.com/username

When displaying on Android Motorola Milestone (2.2.1), iPad 5.0.1, iPad 2 5.0.1 and iPad 3 5.1 it works as expected as well as the simulator.

On iPhone 4S and 4 with iOS 5.0.1 and 5.1 it does not work well. What happens is that the native.showWebPopup control screen size is bigger than the actual screen size (about twice the size of physical screen) and the html elements are centered around a point which is currently outside of physical screen.

I believe this is a bug with the native.showWebPopup on iPhone as the same code works well with Android and iPad, even the simulator.

I am developing currently with a resolution of 768x1024 on config.lua (see below), how ever, I have tried with 640x960 (real iPhone resolution) to see just in case that could afect, but the same occured.

I have also, tried to use a width of 400 pixels for the native.showWebPopup control and it displays accordingly on Android/iPad but on iPhone, it appears full width and text is centered outside view screen.

Here is the lua code to call the native.showWebPopup

[lua] local url = “html-tw/index.html”
local options = { hasBackground=false, baseUrl=system.ResourceDirectory, urlRequest=urlHandler }

– Open my website in a web view.
native.showWebPopup(0,screenH*0.1,screenW,(screenH*0.9), url, options )[/lua]

Here is the html code:


<title>Twitter DCM</title>
  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  
<link rel="stylesheet" href="styles.css" type="text/css" media="screen, projection">
  
  
  

## Andres Maduro

  

  
[![](images/twitter-1a.png) ](http://m.twitter.com/andresmaduro)  

  
  
[/html]  

Here is the config.lua

[lua]application =
{
content =
{

width = 640,
height = 960,
scale = “none”,
},
}[/lua]

Any help is appreciated, if you need, I can provide a working example.

[import]uid: 120459 topic_id: 25831 reply_id: 325831[/import]

Hey there,

It sounds like you might need to submit a bug report - can you do that using the link in the top right of the page, please? If you could include a project we can run and build to reproduce that would be most appreciated.

Peach :slight_smile: [import]uid: 52491 topic_id: 25831 reply_id: 104618[/import]

Hi,

I have built a project that can be used to reproduce the bug. However, I am in a hurry and will post later.

I found a solution (workaround).

Building the test project I found that on iOS (tested on iPhone 4S and iPad 3rd gen), the control width is set to 2*width parameter so I set it to display.contentWidth/2 and it works.

I use the following code that will use width/2 when displaying on a device running iOS, otherwise it will use width, I hope this help others.

[lua]local screenW, screenH = display.contentWidth, display.contentHeight

if(system.getInfo(“environment”) == “device” and system.getInfo(“platformName”) == “iPhone OS”) then
native.showWebPopup(0,screenH*0.1,screenW/2,(screenH*0.9), url, options )

else
native.showWebPopup(0,screenH*0.1,screenW,(screenH*0.9), url, options )
end[/lua]

Hope this helps, I will submit the bug report with test-project soon…

Regards [import]uid: 120459 topic_id: 25831 reply_id: 104782[/import]