我很难把记号笔加上去。(只在Android设备上尝试)我想在地图加载后立即添加标记。让它工作,添加一个延迟,但不能通过添加标记或重新缩放映射(通过使用setRegion)使其工作。
我尝试了以下几点:
1.
局部地图
mapa=native.newMapView( 20, 20, 280, 360 )
mapa.x = display.contentCenterX
mapa.y = display.contentCenterY
mapa.mapType = "standard"
mapa:setCenter( 41.641208, -0.896030 )
mapa:addMarker(tonumber(41.641208), tonumber(-0.896030),{
title = "El Rincon de la Encina",
subtitle = "Ofertas diarias!"})
mapa:setRegion(41.641208, -0.896030, 0.01, 0.01, false)
mapa.isLocationVisible=truelocal mapa
mapa=native.newMapView( 20, 20, 280, 360 )
mapa.x = display.contentCenterX
mapa.y = display.contentCenterY
mapa.mapType = "standard"
mapa:setCenter( 41.641208, -0.896030 )
mapa.isLocationVisible=true
local function listener:timer( event )
mapa:addMarker(tonumber(41.641208), tonumber(-0.896030),{
title = "El Rincon de la Encina",
subtitle = "Ofertas diarias!"})
end
timer.performWithDelay( 30000, listener )只有当计时器在加载映射之后调用函数时,我才会得到想要的结果。
添加tonumber的原因是为了确保Corona得到的数字是正确的。
谢谢你的帮助。
发布于 2015-03-03 23:37:53
一种解决方案是反复对位置硬件排队,直到接收到适当的响应为止,然后调用此函数。有关详细信息,请参阅对象:getUserLocation()中的示例。
https://stackoverflow.com/questions/28830686
复制相似问题