2013-02-28 161 views

回答

5

听起来像是你没有添加委托和协议为您GMSMapView中的对象,是这样的:在的loadView方法

mapView_.delegate = self; 

因此,充分- (void)loadView和委托方法应该是:

@interface ViewController() <GMSMapViewDelegate> // Add this if you haven't 
{ 
    id<GMSMarker> myMarker; 
} 


- (void)loadView { 
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.8683 
                  longitude:151.2086 
                   zoom:6]; 
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 
    mapView_.myLocationEnabled = YES; 
    mapView_.delegate = self; // This sets the delegate for map view 
    self.view = mapView_; 
} 

- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(id<GMSMarker>)marker { 
    NSLog(@"yes"); // And now this should work. 
} 
+2

非常感谢!感觉像一个白痴忘记设置其代表:( – kevnguy 2013-03-01 00:24:38