I have a display group that I want the map view to be a child of.
For example I’m using the TAB view and want to display the map view inside of the TAB view but if I insert the map view into the display group it sill behaves as if it’s not added :
Here’s a snippet:
[blockcode]
function new()
local g = display.newGroup()
local mapGroup = display.newGroup()
local myMap
local btnMapClose
– Map
local btnMap = display.newImage(“btnPhone.png”)
btnMap.x = display.contentWidth*0.5
btnMap.y = 140
function btnMapTouch ( event )
if event.phase == “ended” then
– local mapGroup = display.newGroup()
myMap = native.newMapView( 0, 0, display.contentWidth, display.contentHeight )
myMap.mapType = “normal” – other mapType options are “satellite” or “hybrid”
myMap.isZoomEnabled = true
myMap.isScrollEnabled = true
– The MapView is just another Corona display object, and can be moved or rotated, etc.
myMap.x = display.contentWidth / 2
myMap.y = display.contentHeight / 2
myMap:setRegion( 50.7612369, -3.8003029, 0.2, 0.2, false )
mapGroup:insert(myMap)
btnMapClose = display.newImage(“btnPhone.png”)
btnMapClose.x = display.contentWidth*0.5
btnMapClose.y = display.contentHeight - 200
mapGroup:insert(btnMapClose)
local txtEmail = newRetinaText( “Close”, display.contentWidth*0.5, display.contentHeight - 200, “Verdana”, 14, 0, 0, 0, “center”)
mapGroup:insert(txtEmail)
function btnMapCloseTouch ( event )
if event.phase == “ended” then
mapGroup:removeSelf()
end
end
btnMapClose:addEventListener(“touch”,btnMapCloseTouch)
g:insert(mapGroup)
end
end
[/blockcode] [import]uid: 9371 topic_id: 5801 reply_id: 305801[/import]