the problem is this:
I have a mapkit view with 2 different colors pinpoint. Now i have added in a segmented control to display different map types ie. satellite, standard and hybrid. When my application loads, its correct with 2 different colors. However, when i select the segments, all my pinpoints will change to red colour.
Is there a way to reload all my data and pinpoints such that every segment will give me the same initial view??
- (IBAction) segmentAction:(id)sender
{
UISegmentedControl* segCtl = sender ;
if( [segCtl selectedSegmentIndex] == 0 )
{
NSLog(@"first view");
_mapView.mapType=MKMapTypeStandard;
}
if( [segCtl selectedSegmentIndex] == 1 )
{
NSLog(@"2nd view");
_mapView.mapType=MKMapTypeSatellite;
}
if( [segCtl selectedSegmentIndex] == 2 )
{
NSLog(@"3rd view");
_mapView.mapType=MKMapTypeHybrid;
}
}
Make sure your map view controller implements the viewForAnnotation: method – if this is missing, the pin colors might get reset if the view is refreshed. For example: