gpt4 book ai didi

iOS:MKMapView 在加载时旋转

转载 作者:行者123 更新时间:2023-11-28 21:41:01 30 4
gpt4 key购买 nike

我有一个简单的 map View ,只显示用户的当前位置。我的问题是 map 会旋转,就好像它在加载时试图弄清楚哪条路是北。它也会在加载自身时放大和缩小。它最终确实停下来并且看起来不错,但我想摆脱这种开始旋转和抽搐的情况。我可以添加一些东西来解决这个问题吗?

map 代码:

在 View 中加载:

self.mapView.showsUserLocation=YES;
self.mapView.delegate = self;
[self.mapView setMapType:MKMapTypeHybrid];
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES];

我也有这个方法:

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 500, 500);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
}

谢谢!

最佳答案

你用过,

[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES]; // notice animated is yes

在动画中放入No,

[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO];

关于iOS:MKMapView 在加载时旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32054987/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com