从Google Maps到UITableView的Picker Places [英] Picker Places from Google Maps to UITableView

查看:46
本文介绍了从Google Maps到UITableView的Picker Places的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将Google Maps SDK中Picker Place中的亮点名称放到我自己的TableView中.它应按距中心位置的距离排序.我使用了框架,但是在下面看到了带有选择器位置和表格的自动生成的地图.

I need put names of highlights from Picker Place from Google Maps SDK to my own TableView. It should be order by distance from center place. I used framework but I see automaticly generated map with picker places and table below.

CLLocationCoordinate2D center = CLLocationCoordinate2DMake(37.788204, -122.411937);
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(center.latitude + 0.001,
                                                              center.longitude + 0.001);
CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(center.latitude - 0.001,
                                                              center.longitude - 0.001);
GMSCoordinateBounds *viewport = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast
                                                                     coordinate:southWest];
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:viewport];
_placePicker = [[GMSPlacePicker alloc] initWithConfig:config];


[_placePicker pickPlaceWithCallback:^(GMSPlace *place, NSError *error) {
    if (error != nil) {
        NSLog(@"Pick Place error %@", [error localizedDescription]);
        return;
    }

推荐答案

如您所见, pickPlaceWithCallback 仅返回用户选择的一个位置.

As you've seen, pickPlaceWithCallback only returns a single place that the user picked.

如果您正在寻找用户当前可能在的地点列表,请 currentPlaceWithCallback 将非常适合您.

If you're looking for a list of places that the user is likely at right now, then currentPlaceWithCallback will work well for you.

但是,如果您需要以任意位置为中心的结果列表,那么很遗憾,iOS Places API没有提供实现此目的的方法.

However if you need a list of results centered around an arbitrary location, unfortunately the iOS Places API doesn't offer a way to do that.

这篇关于从Google Maps到UITableView的Picker Places的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆