i am trying to show infowindow
and marker
both simultaneously.
code
-(void)set_markerOnMap:(double)lat longitude:(double)lon{
GMSMarker *marker = [[GMSMarker alloc] init];
marker.title = @"Location selected";
marker.position = CLLocationCoordinate2DMake(lat, lon);
marker.snippet = @"Testing";
marker.icon=[UIImage imageNamed:@"red-pin.png"];
marker.map = self.MyMapView;
[self.MyMapView setSelectedMarker:marker];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self set_markerOnMap:21.214894 longitude:72.88087];
self.MyMapView.delegate=self;
}
above code is working fine and its showing both infowindow
and marker
together.
but my problem is when i called set_markerOnMap
method from didTapAtCoordinate
instead of viewDidLoad
it does not work and only marker
is shown.
code:
- (void)viewDidLoad
{
[super viewDidLoad];
self.MyMapView.delegate=self;
}
- (void) mapView: (GMSMapView *) mapView
didTapAtCoordinate: (CLLocationCoordinate2D) coordinate{
[self set_markerOnMap:21.214894 longitude:72.88087];
}
anyone can help me where i am wrong?