【发布时间】:2013-11-22 09:32:51
【问题描述】:
我的应用程序必须使用文本框集成搜索位置名称。地图套件有什么方法可以实现这种功能吗?下图显示了我到底需要什么
【问题讨论】:
我的应用程序必须使用文本框集成搜索位置名称。地图套件有什么方法可以实现这种功能吗?下图显示了我到底需要什么
【问题讨论】:
没有,MapKit没有任何方法可以实现这种属性..
为此,您必须实现自己的代码,即使用 UISearchbarCantroller 或 Simple UISearchbar。
对于搜索结果,您可以使用Google Place Autocomplete api。
你可以使用这个GooglePlacesAutocomplete Example。
在 iOS >= 6.1 提供MKLocalSearch、MKLocalSearchRequest 来搜索自然语言兴趣点。样本
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.region = regionToSearchIn;
request.naturalLanguageQuery = @"restaurants"; // or business name
MKLocalSearch *localSearch = [[MKLocalSearch alloc] initWithRequest:request];
[localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
// do something with the results / error
}];
【讨论】: