2

GMSPolyline 클래스를 구현하려면 하나의 Google지도 아이콘에서 다른 Google지도 아이콘 방향으로 경로를 표시하는 직선 대신 화살표를 그릴 수 있습니다. Objective C가 아래의 구성을 사용하여 두 개의 클래스를 상속받을 수 있습니까?IOS Google지도에 2 개의 GMSMarkers 사이에 화살표 선 그리기

#import <MessageUI/MessageUI.h> 
#import <GoogleMaps/GoogleMaps.h> 
#import <Foundation/Foundation.h> 
#import <UIKit/UIKit.h> 

@interface ClassA : GMSPolyline { 
} 

-(void)methodA; 

@end 

@interface ClassB : UIView { 
} 

-(void)methodB; 

@end 

@interface MyPolyline : NSObject { 
    ClassA *a; 
    ClassB *b; 
} 

-(void)methodA; 
-(void)methodB; 

@end 




- (void)addMarkers 
{ 
    if([array count] > 0){ 

     [mapView_ clear]; 
     GMSMutablePath *path = [GMSMutablePath path]; 
     GMSMutablePath *currentPath = [GMSMutablePath path]; 

     for (int i = 0; i < [array count]; i++) { 

      CheckPoints *cp = [array objectAtIndex:i]; 
      CLLocationCoordinate2D position = CLLocationCoordinate2DMake(cp.getLatitude , cp.getLongitude); 
      GMSMarker *marker = [GMSMarker markerWithPosition:position]; 
      // GMSMarker *marker = [[GMSMarker alloc] init]; 
      marker.position = position; 
      NSLog(@"%d", cp.getState); 
      NSLog(@"%f", cp.getLatitude); 
      NSLog(@"%f", cp.getLongitude); 
      NSLog(@"%@", cp.getDesp); 
      marker.title = cp.getDesp; 

      NSString *tmpLat = [[NSString alloc] initWithFormat:@"%f", position.latitude]; 
      NSString *tmpLong = [[NSString alloc] initWithFormat:@"%f", position.longitude]; 
      marker.snippet = [NSString stringWithFormat:@"%@ %@", tmpLat,tmpLong]; 
      UIColor *color; 
      GMSPolyline *polyline ; 
      if (cp.getState ==0) { 
       color = [UIColor greenColor]; 
       [path addLatitude:cp.getLatitude longitude:cp.getLongitude]; 
      } else { 
       color = [UIColor redColor]; 
      } 
      if(i > [array indexOfObject:array.lastObject] -2){ 
       [currentPath addLatitude:cp.getLatitude longitude:cp.getLongitude]; 
      } 
      polyline = [GMSPolyline polylineWithPath:path]; 
      polyline.geodesic = YES; 
      polyline.strokeWidth = 5.f; 
     // polyline.strokeColor = [UIColor redColor]; 
      GMSStrokeStyle *solidRed = [GMSStrokeStyle solidColor:[UIColor redColor]]; 
      GMSStrokeStyle *solidRGreen = [GMSStrokeStyle solidColor:[UIColor greenColor]]; 
      polyline.spans = @[[GMSStyleSpan spanWithStyle:solidRed segments:[array count]-1], 
           [GMSStyleSpan spanWithStyle:solidRGreen segments:2]]; 
      marker.icon = [GMSMarker markerImageWithColor:color]; 
      marker.map = mapView_; 
      polyline.map = mapView_; 
     } 

    } 
} 

답변

1

는 여전히 대답을 찾고 있다면 알아,하지만 여기에 하나 개의 옵션입니다하지 마십시오 : 아래 내 운동이다 적절한 경로 엔드 포인트에 사용자 정의 화살표 아이콘으로 GMS 마커를 추가, 그것의 회전을 설정 주어진 선분 (arctan dy/dx)의 기울기에 따라 광고 게시판이 아닌 평면으로 설정되었는지 확인하십시오 (사용자가보기를 회전 할 때 자연스럽게 회전합니다). ,

directed GMSPolyline

+0

는이 스크린 샷에 대한 코드 exampple를 줄 수하십시오 여기에 스크린 샷입니까? – Den

관련 문제