[英]Xcode: My user location doesn't show the first time I run the simulation but the second time it does
Whenever I first open up the project and hit build and run the first time the app won't focus on the current user location. 每当我第一次打开项目并单击“构建并运行”时,应用程序将不会专注于当前用户位置。 But if I stop the simulation and build it again and run it, it will then focus on the user location like I want it to.
但是,如果我停止仿真并再次构建它并运行它,它将像我希望的那样将焦点放在用户位置上。 I can't figure out why it does this, is it something wrong with the simulator or is something wrong with my code?
我不知道为什么这样做,模拟器有问题还是我的代码有问题?
super viewDidLoad];
self.mapview.showsUserLocation = YES;
self.mapview.delegate = self;
[self.mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
For now move self.mapview.showsUserLocation = YES;
现在移动
self.mapview.showsUserLocation = YES;
to the last line. 到最后一行。 This could do what you expect.
这可以达到您的期望。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.