类型 事件 修订版 版本2024.3703 关键词 mapLocation 另请参见 map:requestLocation() map:getUserLocation() mapAddress mapMarker
mapLocation
事件响应调用map:requestLocation()或响应Map的点按事件而异步生成。
在设备上,mapLocation
事件可能会因设备定位硬件的激活而延迟。请参阅map:getUserLocation()了解更多详情。
此事件在Corona Simulator中不可用。
local function mapLocationListener( event ) print( "The tapped location is in: " .. event.latitude .. ", " .. event.longitude ) end -- Create a native map view local myMap = native.newMapView( 20, 20, 300, 220 ) -- Initialize map to a real location since default location (0,0) is not very interesting myMap:setCenter( 37.331692, -122.030456 ) myMap:addEventListener( "mapLocation", mapLocationListener )