0
- (void)loadView {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.551927
longitude:-77.456292
zoom:18];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(37.551709, -77.456510);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hi";
marker.map = mapView;
mapView.settings.myLocationButton = YES;
mapView.myLocationEnabled = YES;
self.view = mapView;
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(37.552243, -77.457415)];
[path addCoordinate:CLLocationCoordinate2DMake(37.551054, -77.455443)];
GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
int x = 0;
if ((x = 1)){
polyline.spans = @[[GMSStyleSpan spanWithColor:[UIColor redColor]]];
}
else polyline.spans = @[[GMSStyleSpan spanWithColor:[UIColor greenColor]]];
polyline.strokeWidth = 10.f;
polyline.map = mapView;}
조건에 따라이 폴리 라인의 색상을 변경하려고합니다. 나는 Xcode를 처음 사용하기 때문에 if 문을 시도했지만 어떤 이유로 작동하지 않는다. 어떤 아이디어라도 감사 할 것입니다!폴리 라인 변경 조건부로