アプリケーション内でレストランを取得するための次のコードがあります
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];
}];
ロードする注釈の数に制限を設定するにはどうすればよいですか? 現在、利用可能なポイントの一部のみがロードされています。さらにズームインすると、コードを再度呼び出すと、追加のポイントが表示されます。