Tag: mkmapitem

将用户位置传递给MKMapItem

我已经显示了用户的位置,我想在MKMApItem显示这些提取的位置。 我知道在MKMapItem显示的方式..但我不能将这些提取的位置传递给MapItem类..可以帮我传递这些值 FBRequest *friendRequest = [FBRequest requestForGraphPath:@"me/friends?field=name,location,hometown"]; [ friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error){ NSArray *data = [result objectForKey:@"data"]; for (FBGraphObject<FBGraphUser> *friend in data) { NSLog(@"%@:%@", [friend name ],[friend.location objectForKey:@"name"]); 和我的输出是: 2013-01-09 17:47:57.096 istb[296:1a03] Athish:Cochin, Kerala 2013-01-09 17:47:57.096 istb[296:1a03] Anges:Mumbai . . . . 2013-01-09 17:47:57.097 istb[296:1a03] Raja:Delhi 2013-01-09 17:47:57.097 istb[296:1a03] Rajesh:Canada 我应该如何将这些位置传递给MKMapItem类 – […]

在iOS 7地图上显示路线:addOverlay没有效果

我想在我的mapView中显示一个点到点的路由,我用这个代码来创build路由: – (IBAction)backToYourCar { MKPlacemark *sourcePlacemark = [[MKPlacemark alloc] initWithCoordinate:self.annotationForCar.coordinate addressDictionary:nil]; NSLog(@"coordiante : locationIniziale %f", sourcePlacemark.coordinate.latitude); MKMapItem *carPosition = [[MKMapItem alloc] initWithPlacemark:sourcePlacemark]; MKMapItem *actualPosition = [MKMapItem mapItemForCurrentLocation]; NSLog(@"coordiante : source %f, ActualPosition %f", carPosition.placemark.coordinate.latitude ,actualPosition.placemark.coordinate.latitude); MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init]; request.source = actualPosition; request.destination = carPosition; request.requestsAlternateRoutes = YES; MKDirections *directions = [[MKDirections alloc] […]

Map上的多个位置(使用MKMapItem和CLGeocoder)

我试图在MKMapItem显示多个位置。 我从CLGeocoder获取这些位置,不幸的是它只接受一个位置。 即使我通过一个NSArray它只是返回一个位置。 以下工作适用于单个位置,但不适用于多个位置。 我怎样才能对多个地点进行地理编码? Class mapItemClass = [MKMapItem class]; if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) { NSArray *addresses = @[@"Mumbai",@"Delhi","Banglore"]; CLGeocoder *geocoder = [[CLGeocoder alloc] init]; [geocoder geocodeAddressString:@[addresses] completionHandler:^(NSArray *placemarks, NSError *error) { CLPlacemark *geocodedPlacemark = [placemarks objectAtIndex:0]; MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:geocodedPlacemark.location.coordinate addressDictionary:geocodedPlacemark.addressDictionary]; MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark]; [mapItem setName:geocodedPlacemark.name]; [MKMapItem openMapsWithItems:@[mapItem] […]