关于如何调用苹果自带的地图APP

CLGeocoder *geoCoder = [[CLGeocoder alloc] init];

// 通过地理编码,得到位置,

CLLocation *loc = [[CLLocation alloc] initWithLatitude:30.662221 longitude:104.041367];

[geoCoder reverseGeocodeLocation:loc completionHandler:^(NSArray *placemarks, NSError *error) {

CLPlacemark *pMark = [placemarks firstObject];

NSData *data = [NSJSONSerialization dataWithJSONObject:pMark.addressDictionary options:NSJSONWritingPrettyPrinted error:nil];

NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

NSLog(@"%@", result);

MKPlacemark *mkMark = [[MKPlacemark alloc] initWithPlacemark:pMark];

//设置地图的以什么形式显示,卫星图,标准图等

NSDictionary *options = @{MKLaunchOptionsMapTypeKey:@(MKMapTypeStandard)};

MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:mkMark];

//调用函数,把地图显示出来。

[mapItem openInMapsWithLaunchOptions:options];

}];

上一篇:Select的深入应用(2)


下一篇:(转)mysql的增删改查