将地图设置为混合没有效果?

发布于 2024-09-03 22:13:40 字数 766 浏览 1 评论 0原文

有谁知道为什么将地图设置为混合没有效果。将其设置为标准并且卫星工作正常吗?

。 。 。

[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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

她比我温柔 2024-09-10 22:13:40

我也有同样的问题。我认为这与位置有关 - 并非所有区域都支持此功能。

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

毅然前行 2024-09-10 22:13:40

你的代码看起来不错并且适合我。您确定问题不在其他地方吗?您是否在某处再次设置地图类型?

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?

悲凉≈ 2024-09-10 22:13:40

您没有在 Interface Builder 中连接 Outlet。

You didn't connect the Outlets in Interface Builder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文