我正在 iOS 应用程序
中使用 Google map
。到目前为止,我能够在 map 上显示用户位置。我试图在单击注释时使用自定义标注。
这是我到目前为止所做的。
1] 创建一个 XIB
文件并为其分配一个 UIView
子类的类名。
2]使用markerInfoWindow委托(delegate)方法如下。
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
{
CustomGoogleCallOut *view = [[[NSBundle mainBundle]loadNibNamed:@"CustomGoogleCallOut" owner:self options:nil]objectAtIndex:0];
view.callOutImageView.image = [UIImage imageNamed:@"avatar.png"];
view.callOutTitleLabel .text = @"title";
view.callOutUserName.text = @"Mario";
return view;
}
但是我看不到调用。我在这里错过了什么?
最佳答案
您缺少代表。在 h 文件中
: UIViewController<GMSMapViewDelegate>
在.m 文件中
mapView.delegate = self;
关于ios - 在 iOS 中使用 Google map 时如何使用自定义标注进行注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20921054/