Custom InfoWindows issue -Google Maps iOS SDK-

≡放荡痞女 提交于 2019-12-25 02:01:44

问题


I've followed the Google Maps Custom InfoWindows Video very closely and can't seem to get mine to work. Here is part of my viewcontroller.m:

GMSMarker *food = [[GMSMarker alloc] init];
food.position = CLLocationCoordinate2DMake(43.468725, 11.287411);
food.map = mapView_;
mapView_.mapType = kGMSTypeTerrain;
food.icon = [UIImage imageNamed:@"foodmarker"];

}
-(UIView *) mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)food
{

CustomInfoWindow *infoWindow = [[[NSBundle mainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0];
infoWindow.name.text = @"FoodPlace";
infoWindow.address.text = @"Some kinda food location";
infoWindow.photo.image = [UIImage imageNamed: @"food"];
return infoWindow;
}

I get an error on return infoWindow saying: Incompatible pointer types returning 'CustomInfoWindow *' from a function with result type 'UIView *'

My CustomInfoWindow class is wired up to the Nib that will be displayed as the custom info window. The issue is that when I tap on the marker nothing happens or appears.


回答1:


I'm not sure about this but I think you can fix this by going to the Identify Inspector. This is the area on the right of XCode, third button from right. Or View->Utilities->Show Identity Inspector. At the top of identity inspector, you can set the custom class. Right now it is probably UIView. Set it instead to CustomInfoWindow.



来源:https://stackoverflow.com/questions/22694740/custom-infowindows-issue-google-maps-ios-sdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!