【问题标题】:How to trace map region while scrolling Map in iPhone如何在 iPhone 中滚动地图时跟踪地图区域
【发布时间】:2012-03-16 10:37:36
【问题描述】:

我已完成以最大化缩放级别在 iPhone 中显示当前位置的地图视图。

但现在我想在地图视图中跟踪 任何滚动 以获取其可见区域。

如果是的话,是否有任何事件可以做到这一点??

如果没有怎么可能?

【问题讨论】:

    标签: iphone ios google-maps


    【解决方案1】:

    是的,可以通过 mapView 的委托来实现。

    - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
    {
        // This method is called whenever the currently displayed map region changes. 
        // During scrolling, this method may be called many times to report updates to the map position. 
        // Therefore, your implementation of this method should be as lightweight as possible to avoid affecting scrolling performance. 
       // *Straight from Apple's documentation
    
       MKMapRect visibleRect = [mapView visibleMapRect];
    }
    

    【讨论】:

    • 哎呀...它不工作..!!!我只是将这个编码粘贴到我的实现并设置调试器..它不工作..
    • 你能解释一下到底是什么不工作吗?您是否设置了 mapView 的委托?
    • @Downloadmore 它完美运行。也许您忘记为地图视图设置delegate。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多