我的应用程序必须使用文本框集成搜索位置名称。 Map kit有什么方法可以实现这种功能吗?下图显示了我真正需要的
No,MapKit没有任何方法来实现这种类型的属性。
为此,您必须实现自己的代码,即使用 UISearchbarCantroller 或 Simple UISearchbar。
对于搜索结果,您可以使用Google 地点自动完成 https://developers.google.com/places/documentation/autocomplete api.
你可以使用这个Google 地点自动完成示例 https://github.com/spoletto/SPGooglePlacesAutocomplete.
在
iOS >= 6.1 提供MK本地搜索 https://developers.google.com/places/documentation/autocomplete, MKLocalSearch 请求 https://github.com/spoletto/SPGooglePlacesAutocomplete搜索自然语言兴趣点。样本
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
}];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)