我有以下代码用于在我的应用程序中检索餐馆
NSLog(@"getting restaurants");
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = @"restaurant";
request.region = self.mapView.region;
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) {
MapViewAnnotation *annotation = [[MapViewAnnotation alloc] initWithPlacemark:item.placemark];
annotation.title = item.name;
annotation.coordinate = item.placemark.location.coordinate;
//annotation.subtitle = item.placemark.addressDictionary[kABPersonAddressStreetKey];
//annotation.phone = item.phoneNumber;
[annotations addObject:annotation];
}];
[self.mapView addAnnotations:annotations];
}];
如何设置要加载多少注释的限制?现在,只有少数可用点被加载。当我进一步放大时,我再次调用代码,并出现其他点。