mapLocation

类型 事件
修订版 版本2024.3703
关键词 mapLocation
另请参见 map:requestLocation()
map:getUserLocation()
mapAddress
mapMarker

概述

mapLocation事件响应调用map:requestLocation()或响应Map的点按事件而异步生成。

注意事项

属性

event.errorMessage

event.isError

event.name

event.latitude

event.longitude

event.request

event.type

示例

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 )