将地图设置为混合没有效果?
有谁知道为什么将地图设置为混合没有效果。将其设置为标准并且卫星工作正常吗?
。 。 。
[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;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。我认为这与位置有关 - 并非所有区域都支持此功能。
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?
您没有在 Interface Builder 中连接 Outlet。
You didn't connect the Outlets in Interface Builder.