views:

50

answers:

2

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:
            break;
    }
}
A: 

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?

nevan
No, I am running it through the simulator though, could that be the reason? It switches to standardview and everything. Let me add the rest of the code
TheLearner
Put some log statements into your switch statement to see if the hybrid case is actually getting called. That might give a clue to what's happening. Try changing the first case to hybrid.
nevan
Yep the hybrid is actually being called
TheLearner
WHat I mean is that its still not working - its definitely being called but has no affect even running on the device
TheLearner
A: 

I have also the same problem. I think it has to do with the location - not all areas are supported for this feature.

Meir