【问题标题】:how to lock GMSCameraPosition movement in GMSMapView如何在 GMSMapView 中锁定 GMSCameraPosition 移动
【发布时间】:2015-07-11 21:06:36
【问题描述】:

我想在 iOS 版 Google 地图中锁定相机,但到目前为止没有成功。

目标是将相机指向一个位置,并防止用户自己移动相机。过了一会儿,我想把相机控制权还给用户

谢谢

GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:location.coordinate zoom:mapView_.camera.zoom];    
[mapView_ animateToCameraPosition:camera];
//here i would like to lock the camera
//do some stuff
//give the user the control back

【问题讨论】:

    标签: ios xcode google-maps-sdk-ios


    【解决方案1】:

    查看GMSUISettings 上的setAllGesturesEnabled 方法。例如:

    [mapView_.settings setAllGesturesEnabled: NO];
    

    【讨论】:

    • 感谢您的回答,我实际上使用了“相机将移动”委托将相机保持在同一个地方。因为我希望用户能够与地图交互但不移动相机。
    • @idanOS 你想分享你是如何实现这个的吗?我遵循了你的想法,它在一定程度上有效,但我确实面临在地图上平滑滑动菜单的问题,尤其是取消已经开始的边缘滑动。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-30
    • 1970-01-01
    • 2017-07-26
    • 1970-01-01
    • 1970-01-01
    • 2012-04-24
    相关资源
    最近更新 更多