2014-05-19 3 views
0

코로나 SDK의 MapView에 대한 도움이 필요합니다. 배경으로지도를 넣고 싶지만 (이 경우 모든 기능 포함),이 경우 앞에있는 버튼을 누르십시오. 맵뷰 MapView는 기본 객체가 내가 어떤 그룹과 '지도보기 : toBack()'에 추가 할 수 없습니다 때문에MapView to background - 코로나 SDK

function scene:createScene(event) 
    local group = self.view 

    if (system.getInfo("environment") == "simulator") then 
     local simulatorMessage = "Maps not supported in Corona Simulator.\nYou must build for iOS or Android to test native.newMapView() support." 
     local label = display.newText(simulatorMessage, 36, 40, 270, 0, native.systemFont, 12) 
     label.anchorX = 0 
     label.anchorY = 0 
    end 

    myMap = native.newMapView(20, 20, display.contentWidth, display.contentHeight) 

    if (myMap) then 
     myMap.mapType = "normal" 
     myMap.x = display.contentCenterX 
     myMap.y = display.contentCenterY 
     myMap:setCenter(currentLatitude, currentLongitude) 
     myMap:addEventListener("mapLocation", mapLocationListener) 
    end  

    backBtn = widget.newButton 
    { 
     id="backButton", 
     label="Back", 
     fontSize="30", 
     labelColor={ default={1, 1, 1}, over={0, 0, 0, 0.5} }, 
     defaultFile="images/button.png", 
     width = dispWidth * 0.25, height = dispHeight * 0.1, 
     onRelease = onBackBtnRelease 
    } 
    backBtn.anchorX = 0.5 
    backBtn.anchorY = 0.5 
    backBtn.x = display.contentWidth * 0.8 
    backBtn.y = dispHeight * 0.8 
    backBtn:toFront() 

    group:insert(backBtn) 
    group:toFront() --second try to put that button to front 
end 

: 여기 내 코드 '시도 인덱스 upvalue에'(잘 작동하지 않습니다에는 myMap '(nil 값)'). 코로나 SDK에서 버튼은 예상대로 맵없이 표시됩니다. 장치에서 나는 예상대로 내 버튼이없는지도를 얻습니다.

네이티브 개체를 뒤쪽에 배치하거나 무언가를 앞쪽으로 배치 할 수 있습니까?

답변

1

지도 및 버튼으로하려는 작업은 현재 CoronaSDK에서 가능하지 않습니다.

실제로 MapView는 네이티브 개체입니다. Corona의 설명서에 따르면 MapView 위에 다른 객체를 배치 할 수 없습니다.

문서는 말한다 :

지도 객체는 다른 고유 표시 객체와 같은 그룹으로 삽입 할 수 없습니다 항상 일반 표시 객체 (그룹, 벡터, 이미지 및 텍스트)의 상단에 표시됩니다.

See documentation here

행운 코딩

. 뒤에 오는

+0

디자인이 변경되었습니다. 코로나에는 결함이 있으며 단순한 앱/게임 이외의 다른 용도로 사용하지 않는 것이 좋습니다. – Arthur

+0

@Arthur 동의합니다. 네이티브 개체에 더 많은 융통성이 필요합니다.지도 앱을 개발 중이며 정확한 이유 때문에 네이티브로 이동해야했습니다. 이 솔루션은 코로나 카드를 사용하여 코로나와 네이티브를 혼합 할 수 있지만 현재 베타 버전입니다. –

0

먼저 확인 : 버튼이있을 것입니다 장치의 가장 일반적인 문제에 나타나지 않는 경우

, 당신은 이미지의 이름을 잘못 입력 (캡 확인) 또는 파일의 경로를 확인할 수있는 적절한 여부입니다.

이지도보기에 대해 자세히 알려면 : http://docs.coronalabs.com/api/library/native/newMapView.html

나는 당신이 이미 방문한 수도 알고, 그것의 더 나은 다시 본다.

고마워,