2016-01-13 27 views
1

我想用修改的标记和细节打开我的经度和纬度值。因此,我需要检查是否需要打开Goog​​le地图应用,否则我将导航到苹果地图。使用地图和标记针打开位置

在这里我不能添加自定义引脚与下面的代码,

 NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"maps.apple.com/?z=12&q=%f,%f",[latitude floatValue],[longitude floatValue]]]; 

     if (![[UIApplication sharedApplication] canOpenURL:url]) { 
      NSLog(@"Google Maps app is not installed"); 
      //left as an exercise for the reader: open the Google Maps mobile website instead! 
      MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:rdOfficeLocation addressDictionary:nil]; 

      MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark]; 

      item.name = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"NAME"]]; 
      item.phoneNumber = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"DESTINATION"]]; 
      [item openInMapsWithLaunchOptions:nil]; 

     } else { 

      [[UIApplication sharedApplication] openURL:url]; 

     } 

所以,请帮我添加自定义引脚值两个苹果和谷歌地图。

回答

0

你可以看看如何在官方文档中添加custom marker。但是,这只适用于Google地图,而不适用于Apple地图(在这种情况下,您需要为其提供不同的库)