Rag*_*jji 6 objective-c google-maps-markers ios google-maps-sdk-ios
我在谷歌地图iOS SDK中放置了6个具有相同坐标的自定义标记.这些标记持续闪烁/切换.我根本不想要动画闪烁.请帮我.
这是我的源代码.
-(void)loadPlacesInMapWithIndex:(int)index{
for (int i = 0; i < [[[SearchManager sharedInstance]searchedStallArray] count]; i++) {
Stall *stall = [[[SearchManager sharedInstance]searchedStallArray] objectAtIndex:i];
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake([stall.stallLatitude doubleValue],[stall.stallLongitude doubleValue]);
marker.infoWindowAnchor = CGPointMake(0.44f, -0.07f);
marker.userData = stall;
marker.tappable = YES;
self.infoView = [[[NSBundle mainBundle]loadNibNamed:@"StallInfoWindow" owner:self options:nil] objectAtIndex:0];
marker.iconView = self.infoView;
if (index == i) {
[self.infoView.stallPinImageView setImage:[UIImage imageNamed:@"RateLabel.png"]];
[self.infoView.stallPriceLabel setTextColor:[UIColor whiteColor]];
CGFloat currentZoom = self.stallsMapView.camera.zoom;
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat: 0.5f] forKey:kCATransactionAnimationDuration];
[self.stallsMapView animateToCameraPosition:[GMSCameraPosition
cameraWithLatitude:[stall.stallLatitude doubleValue]
longitude:[stall.stallLongitude doubleValue]
zoom:currentZoom]];
[CATransaction setCompletionBlock:^{
}];
[CATransaction commit];
}else{
[self.infoView.stallPinImageView setImage:[UIImage imageNamed:@"horse.png"]];
[self.infoView.stallPriceLabel setTextColor:[UIColor redColor]];
}
self.infoView.stallPriceLabel.text = [NSString stringWithFormat:@"$%@",stall.stallPrice];
marker.map = self.stallsMapView;
}
}
Run Code Online (Sandbox Code Playgroud)
小智 12
你必须提供不同的zIndex属性.此属性定义哪个标记位于堆栈顶部.最高的数字是最重要的.
对于您的代码,请插入:
marker.tappable = YES;
Run Code Online (Sandbox Code Playgroud)
这行代码:
marker.zIndex = (UInt32)i
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2136 次 |
| 最近记录: |