Hi Danny,
This code runs fine on Android but doesn’t work in iOS.
I use build 2013.1094
local widget = require( "widget" ) local ruta\_imaxes = "recursos/imaxes/" local establecemento = storyboard.newScene() local anchoVisible,altoVisible = display.viewableContentWidth,display.viewableContentHeight local contenedor local webView local mapa local grupoMapa = display.newGroup() --\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -- webListener() Listener da táboa de tarifas --\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* local function webListener(event) if event.phase == "moved" then local dx = math.abs( event.x - event.xStart ) local dy = math.abs( event.y - event.yStart ) -- if finger drags button more than 5 pixels, pass focus to scrollView if dx \> 5 or dy \> 5 then contenedor:takeFocus( event ) end elseif event.phase == "ended" then print( "toca webView" ) end return true end --------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- Called when the scene's view does not exist: function establecemento:createScene( event ) local grupoEstablecemento = self.view local fondo = display.newRect(0,0,anchoVisible,altoVisible) fondo:setFillColor(255,0,0) local cabeceira = display.newImageRect(ruta\_imaxes.."fondo\_cabecera2\_"..idioma..".png",1024,61) cabeceira:setReferencePoint(display.TopLeftReferencePoint) cabeceira.x = 0 cabeceira.y = 0 contenedor = widget.newScrollView { id = "contenedor", width = 1024, height = 768, horizontalScrollDisabled = true, verticalScrollDisabled = false, bottomPadding = 400, } webView = native.newWebView( 10, 724, 1004, 400 ) --webView:setReferencePoint(display.TopLeftReferencePoint) webView.x = anchoVisible/2 -200 --webView.y = 100 --724 webView.hasBackground = false local function redeListener( event ) local evento = event if ( evento.isError ) then local alertaConexion = native.showAlert( "Alert", "Internet connection error.", { "OK" }) else webView:request( "proba.html", system.DocumentsDirectory ) webView:addEventListener( "urlRequest", webListener ) end end network.download( "http://www.e-imaxina.com/proba.html", "GET", redeListener, "proba.html", system.DocumentsDirectory ) local function accionInicio(event) storyboard.gotoScene("estanteria") end local boton\_inicio = widget.newButton{ id = "inicio", left = 7, top = 7, width = 47, height = 46, defaultFile = ruta\_imaxes.."boton\_inicio\_x\_reposo.png", overFile = ruta\_imaxes.."boton\_inicio\_x\_activo.png", onRelease = accionInicio, } -- Mapa -- mapView mapa = native.newMapView( 0, 247, 320, 351 ) mapa.mapType = "normal" -- other mapType options are "satellite" and "hybrid". mapa.x = 1 + mapa.width/2 mapa.y = 248 + mapa.height/2 local latitudeM = 42.496751 local lonxitudeM = -8.863799 mapa:setCenter( latitudeM, lonxitudeM ) mapa:addMarker( latitudeM, lonxitudeM ) contenedor:insert(mapa) contenedor:insert(webView) grupoEstablecemento:insert(fondo) grupoEstablecemento:insert(contenedor) grupoEstablecemento:insert(cabeceira) grupoEstablecemento:insert(boton\_inicio) end -- Called BEFORE scene has moved onscreen: function establecemento:willEnterScene( event ) local grupoEstablecemento = self.view end -- Called immediately after scene has moved onscreen: function establecemento:enterScene( event ) local grupoEstablecemento = self.view storyboard.removeScene( escenaActual ) escenaActual="establecemento" end -- Called when scene is about to move offscreen: function establecemento:exitScene( event ) local grupoEstablecemento = self.view end -- Called AFTER scene has finished moving offscreen: function establecemento:didExitScene( event ) local grupoEstablecemento = self.view end -- Called prior to the removal of scene's "view" (display group) function establecemento:destroyScene( event ) local grupoEstablecemento = self.view end -- Called if/when overlay scene is displayed via storyboard.showOverlay() function establecemento:overlayBegan( event ) local grupoEstablecemento = self.view local overlay\_name = event.sceneName -- name of the overlay scene end -- Called if/when overlay scene is hidden/removed via storyboard.hideOverlay() function establecemento:overlayEnded( event ) local grupoEstablecemento = self.view local overlay\_name = event.sceneName -- name of the overlay scene end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist establecemento:addEventListener( "createScene", establecemento ) -- "willEnterScene" event is dispatched before scene transition begins establecemento:addEventListener( "willEnterScene", establecemento ) -- "enterScene" event is dispatched whenever scene transition has finished establecemento:addEventListener( "enterScene", establecemento ) -- "exitScene" event is dispatched before next scene's transition begins establecemento:addEventListener( "exitScene", establecemento ) -- "didExitScene" event is dispatched after scene has finished transitioning out establecemento:addEventListener( "didExitScene", establecemento ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). establecemento:addEventListener( "destroyScene", establecemento ) -- "overlayBegan" event is dispatched when an overlay scene is shown establecemento:addEventListener( "overlayBegan", establecemento ) -- "overlayEnded" event is dispatched when an overlay scene is hidden/removed establecemento:addEventListener( "overlayEnded", establecemento ) --------------------------------------------------------------------------------- return establecemento
I’ve tryed to test it with widget 1.0 but I can’t make it works fine on iPad.
Nevertheless, I showed the app to my client when I was using widget 1.0 and we’d seen it was working fine.