2016-09-16 13 views
3

私は、GoogleマップのiOS SDKに同じ座標で6つのカスタムマーカーを配置しました。これらのマーカーは連続的に点滅/トグルしています。私はまったくの点滅アニメーションを望んでいません。私を助けてください。Googleマップで点滅するカスタムマーカーiOS

私のソースコードです。

-(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; 
    } 
} 
+0

はあなたのコードを表示します! – user3207158

+0

どのバージョンのGoogle Maps SDKをお使いですか? –

+0

体は何か助けてください。私は解決策を待っている。 –

答えて

0

zIndex property of the markersをセットアップしようとしましたか?おそらくマーカーが重なっているので、マーカーが点滅するのは明らかな描画順序がないためです。

+0

私はしていません。ソースコードの例を教えてください。 –

+0

この点滅している問題は、zIndexプロパティを追加して解決しました。 –

5

あなたはそれらを提供する必要がありますzIndexプロパティ。このプロパティは、スタックの先頭にあるマーカーを定義します。最高の数字が上にあります。あなたのコードの場合

、下に挿入:このコード行

marker.tappable = YES; 

marker.zIndex = (UInt32)i 
+0

ありがとうございます@ B2Dそれは私を働いています。 –

関連する問題