【发布时间】:2016-04-29 10:34:20
【问题描述】:
我正在尝试从 xib 文件加载 UIView 作为我的 GMSMarker 信息窗口。我正在尝试这样做:
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
{
//Creating "infoWindow"(infoWindow) and setting it with nib file called "infoWindow"
CustomMarkerInfoWindow *infoWindow=[[[NSBundle mainBundle] loadNibNamed:@"CustomMarkerInfoWindow" owner:self options:nil] firstObject];
//Setting "infoWindow"(infoWindow)'s storeNameLabel's text to "marker"(customMarker)'s title
infoWindow.storeNameLabel.text=((customMarker*)marker).title;
//Setting "infoWindow"(infoWindow)'s storeAddressLabel's text to marker's address
infoWindow.storeAddressLabel.text=((customMarker*)marker).address;
return infoWindow;
}
但是当我点击一个标记时,信息窗口不显示并且所有应用程序都冻结了(要再次开始使用它,我需要在我从多任务处理中杀死它后重新打开它)。
注意:如果我这样做,一切正常(创建一个常规的UIView):
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
{
UIView *myView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
myView.backgroundColor=[UIColor blueColor];
return myView;
}
有人知道为什么会这样吗?一个多星期都看不懂!
如果有人可以在这里帮助我,我真的很感激,非常感谢!
【问题讨论】:
标签: ios objective-c iphone cocoa-touch google-maps-sdk-ios