AnsweredAssumed Answered

Change mapView Layers using segmented control from another view controller

Question asked by gisplanners on Dec 12, 2012
Latest reply on Dec 14, 2012 by gisplanners
I have 2 UIViewControllers

1). sgViewController which contains mapView
2). ConfigViewController which contains one Segmented control with three buttons.

first view controller (sgViewController) has a button with segue (Partial curl) which shows second view controller.

In the second view controller, i have segmented control "mapTypeChanged". Based on selected segment index, i want to change the map view layers in first view controller (sgViewController).

here is what i am doing but unable to see what i am trying to achieve.

- (IBAction)mapTypeChanged:(id)sender {
   
   sgViewController *sVC = [self.storyboard instantiateViewControllerWithIdentifier:@"sgViewController"];
   
    switch (self.mapType.selectedSegmentIndex) {
        case 0:
            // aready here - do nothing
            break;
        case 1:
          
            [sVC.mapView reset];
            [sVC.mapView addMapLayer:LayerName withName:@"LayerName"];
           
            break;
        case 2:
            // will change more layers here

            break;
        default:
            break;
    }
   
}

Outcomes