I want to add SegmentedControl to my MKMapView With three Segments
- StandardView
- SatelliteView
- HybridView
and we can change map type by taping segments
i have try some code
- (void)indexDidChangeForSegmentedControl:(UISegmentedControl *)aSegmentedControl {
NSArray *itemArray = [NSArray arrayWithObjects: @"One", @"Two", @"Three", nil];
segControl= [[UISegmentedControl alloc] initWithItems:itemArray];
if((segControl.selectedSegmentIndex = 0)){
_mapView = MKMapTypeStandard;
}
if((segControl.selectedSegmentIndex = 1)){
_mapView = MKMapTypeSatellite;
}
else {
_mapView = MKMapTypeHybrid;
}
}
Hey try with this condition
segControl.selectedSegmentIndex == 0instead of thissegControl.selectedSegmentIndex = 0here problem with single = sign
and Also try like this bellow code..