|
@@ -90,32 +90,33 @@
|
|
|
|
|
|
|
|
- (void)locationCell:(RADetailLocationCell *)cell didClickNavigation:(RADetailLocationModel *)model {
|
|
- (void)locationCell:(RADetailLocationCell *)cell didClickNavigation:(RADetailLocationModel *)model {
|
|
|
|
|
|
|
|
|
|
+ // @"东大街芷泉段6号"
|
|
|
|
|
+
|
|
|
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
|
|
-// if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
|
|
|
|
|
-//
|
|
|
|
|
-// UIAlertAction *googleMapAction = [UIAlertAction actionWithTitle:@"Google Map" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
-//
|
|
|
|
|
-// NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?center=37.782652,-122.410126&directionsmode=driving"]
|
|
|
|
|
-// stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
|
|
-//
|
|
|
|
|
-// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:^(BOOL success) {
|
|
|
|
|
-// NSLog(@"%u",success);
|
|
|
|
|
-// }];
|
|
|
|
|
-//
|
|
|
|
|
-//// NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?center=37.782652,-122.410126&directionsmode=driving"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
|
|
-//// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
|
|
|
|
|
-//
|
|
|
|
|
-// }];
|
|
|
|
|
-// [alertVC addAction:googleMapAction];
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *googleMapAction = [UIAlertAction actionWithTitle:@"Google Map" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?q=%@&directionsmode=driving",model.location]
|
|
|
|
|
+ stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
|
|
+
|
|
|
|
|
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:^(BOOL success) {
|
|
|
|
|
+ NSLog(@"%u",success);
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+// NSString *urlString = [[NSString stringWithFormat:@"comgooglemaps://?center=37.782652,-122.410126&directionsmode=driving"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
|
|
+// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertVC addAction:googleMapAction];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
UIAlertAction *appleMapAction = [UIAlertAction actionWithTitle:@"Apple Map" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
UIAlertAction *appleMapAction = [UIAlertAction actionWithTitle:@"Apple Map" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
|
|
|
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
|
|
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
|
|
|
// MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(37.782652, -122.410126) addressDictionary:nil]];
|
|
// MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(37.782652, -122.410126) addressDictionary:nil]];
|
|
|
- // @"东大街芷泉段6号"
|
|
|
|
|
|
|
+
|
|
|
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:kCLLocationCoordinate2DInvalid
|
|
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:kCLLocationCoordinate2DInvalid
|
|
|
addressDictionary:@{
|
|
addressDictionary:@{
|
|
|
(__bridge id)kABPersonAddressStreetKey : model.location
|
|
(__bridge id)kABPersonAddressStreetKey : model.location
|