IOS方向的谷歌地图SDK

IOS方向的谷歌地图SDK,ios,objective-c,xcode,google-maps,google-maps-sdk-ios,Ios,Objective C,Xcode,Google Maps,Google Maps Sdk Ios,我用GMS创建了一个简单的IOS应用程序。我在特定位置添加了一些标记。我只想当用户点击标记时,我的应用程序应该在用户位置和点击标记之间画一条线。我没有找到标记,我没有找到方法 - (void)viewDidLoad { [super viewDidLoad]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868

我用GMS创建了一个简单的IOS应用程序。我在特定位置添加了一些标记。我只想当用户点击标记时,我的应用程序应该在用户位置和点击标记之间画一条线。我没有找到标记,我没有找到方法

- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
                                                        longitude:151.2086
                                                             zoom:12];

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.settings.compassButton = YES;
mapView_.settings.myLocationButton = YES;

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;





GMSMarker *marker1 = [[GMSMarker alloc] init];
marker1.position = CLLocationCoordinate2DMake(40.992735,28.789164);
marker1.title = @"ASD";
marker1.map = mapView_;
我的应用程序正在使用LocationServices在我的当前位置打开。我只想知道用户和用户点击标记之间的方向。我该怎么做

谢谢大家!! 祝大家今天愉快

In -(void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker// This method will get call after taping marker pin(GMSMapView map view delegate method).
{ get the latitude and longitude of that marker.

}

Take the latitude and longitude of current location

Now Draw route between two location
//Download LRouteController from this link  https://github.com/lukagabric/LRouteController

//This will draw link between two co-ordinate
//In .h File declare LRouteController *_routeController;
 if ([_coordinates count] > 1)
    {
        //Draw line between two co-ordinate
        [_routeController getPolylineWithLocations:_coordinates travelMode:TravelModeDriving andCompletitionBlock:^(GMSPolyline *polyline, NSError *error) {
            if (error)
            {
                NSLog(@"%@", error);
            }
            else if (!polyline)
            {
                NSLog(@"No route");
                [_coordinates removeAllObjects];
                UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"No route" message:@"No route available for this route." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                [alert show];
            }
            else
            {
                //Drow route
                _markerStart.position = [[_coordinates objectAtIndex:0] coordinate];
                _markerStart.map = googleMapview;

                _markerFinish.position = [[_coordinates lastObject] coordinate];
                _markerFinish.map = googleMapview;

                _polyline = polyline;
                _polyline.strokeWidth = 3;
                _polyline.strokeColor = [UIColor blueColor];
                _polyline.map = googleMapview;
            }
        }];
    }


//If you are unable to get taped pin latitude and longitude the you can use custom GMSMarker
Ex: @interface MapMarker : GMSMarker //Create new file of GMSMarker
@property (nonatomic, strong) coOrdinateData *data;(CoOrdinateData is NSObject class declare lat and long value)
@end

While adding marker on map use 
 MapMarker *marker= [[MapMarker alloc]init];

            [marker setPosition:CLLocationCoordinate2DMake(LocationAtual.coordinate.latitude,LocationAtual.coordinate.longitude)];
  marker.data=data;//Take lat and long value in object class and pass object class in marker object
After typing on map marker you can get value like
-(void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker
{
NSString *strLat = ((MapMarker *)marker).data.lat ;
NSString *strLong = ((MapMarker *)marker).data.long ;
//Add both the current location and marker  latitude and longitude in _coordinates and draw route.
}