Does anyone know why setting the map as hybrid has no effect. Setting it as standard and satellite works fine though?
. . .
[segmentedControl addTarget:self action:@selector(handleSegmentClick:) forControlEvents:UIControlEventValueChanged];
[window makeKeyAndVisible];
return YES;
}
- (void)handleSegmentClick:(id)sender
{
NSLog(@"changeSegment");
UISegmentedControl *sc = (UISegmentedControl *)sender;
NSInteger index = sc.selectedSegmentIndex;
switch (index)
{
case 0:
[mapView setMapType: MKMapTypeStandard];
break;
case 1:
[mapView setMapType: MKMapTypeSatellite];
break;
case 2:
[mapView setMapType: MKMapTypeHybrid];
break;
default:
brea开发者_高级运维k;
}
}
I have also the same problem. I think it has to do with the location - not all areas are supported for this feature.
Your code looks fine and works for me. Are you sure the problem isn't somewhere else? Are you setting the map type again somewhere?
You didn't connect the Outlets in Interface Builder.
精彩评论