使用谷歌地图和GMSMarker activityIndi​​cator没有呈现

时间:2014-02-04 00:44:47

标签: xcode google-maps-markers uiactivityindicatorview

我正在实现此功能,展示自定义信息窗口

- (BOOL)mapView:(GMSMapView *)p_mapView didTapMarker:(GMSMarker *)p_marker

我希望在信息窗口的数据加载时显示一个activityIndi​​cator,代码:

UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityIndicator.color = [UIColor redColor];
activityIndicator.frame = (markerPoint.x,markerPoint.y, activityIndicator.frame.size.width, activityIndicator.frame.size.height);
[activityIndicator startAnimating];
[self.view addSubview:activityIndicator];

但是activityinfo没有显示,在我正在构建和加载信息窗口并将其添加到当前地图视图的同一个函数中

[self.view addSubview:markerInfoWindow];

在调试时我注意到信息窗口仅在功能完成后显示,所以我猜这就是为什么我的活动信息没有显示,

如何强制ui渲染以显示活动指示符?

1 个答案:

答案 0 :(得分:1)

我想也许您正在寻找的委托方法是

-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker

Google Map SDK的文档参考以及以下链接中的更多Marker自定义详细信息。自您发布问题以来,这已经更新,因此有一些新的委托方法值得一试。

MapView Marker documentation

MapView delegate methods

相关问题