我在mkmapview上实现了一个在特定区域内的MKLocalSearch,它返回区域内的一系列餐馆。通过研究,只有10家餐馆被展示出来。有没有办法让MKLocalSearch在一个地区内返回10多家餐馆?这是密码,
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc]init];
request.naturalLanguageQuery = @"restaurant";
request.region = midRegion;
MKLocalSearch *localSearch = [[MKLocalSearch alloc]initWithRequest:request];
[localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
NSMutableArray *annotations = [NSMutableArray array];
[response.mapItems enumerateObjectsUsingBlock:^(MKMapItem *item, NSUInteger idx, BOOL *stop){
CustomAnnotation *annotation = [[CustomAnnotation alloc] initWithPlacemark:item.placemark];
annotation.title = item.name;
annotation.subtitle = item.placemark.addressDictionary[(NSString *)kABPersonAddressStreetKey];
annotation.phone = item.phoneNumber;
[annotations addObject:annotation];
}];
[self.mapView addAnnotations:annotations];
}];
} 发布于 2016-07-12 22:38:16
所以,虽然我已经有一段时间没有问这个问题了,但我还是想谈谈,因为我认为我应该这样做。在堆栈溢出和苹果开发者论坛上偶然发现各种链接后,内置的MKLocalSearch方法似乎仅限于返回10个结果。然而,Google可以返回多达60个结果。因此,恐怕我的问题的答案是
No,您无法获得MKLocalSearch方法来返回与特定naturalLanguageQuery关键字关联的区域中的10个以上位置。
https://stackoverflow.com/questions/29322394
复制相似问题