MKMapView 地图类型没有改变?
我无法理解为什么我的 MKMapView 不想更改为卫星视图。调用此方法并调用案例 1 我已跳过它,但它根本没有更改为卫星类型,它始终更改为标准。仅当返回 Map 类型时才有效。有人有什么想法吗?
- (IBAction)mapSatelliteSegmentControlTapped:(UISegmentedControl *)sender
{
switch (sender.selectedSegmentIndex)
{
case 1: //Satellite
self.mapView.mapType = MKMapTypeSatellite;
default: //Map
self.mapView.mapType = MKMapTypeStandard;
}
}
I cannot understand why my MKMapView does not want to change to satellite view. This method is called and case 1 is called I have stepped over it but it simply does not change to satellite type it always changes to standard. It only works when it goes back to Map type. Anyone have any ideas?
- (IBAction)mapSatelliteSegmentControlTapped:(UISegmentedControl *)sender
{
switch (sender.selectedSegmentIndex)
{
case 1: //Satellite
self.mapView.mapType = MKMapTypeSatellite;
default: //Map
self.mapView.mapType = MKMapTypeStandard;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 MKMapView 随时准备更改为卫星视图。但你强迫它处于标准视图中。
“您错过了
情况 1
中的break
语句”。Your MKMapView is always ready to change to the satellite view. But you are forcing it to be in the standard view.
"You missed the
break
statement incase 1
".使用此代码并在 xib 上通过“更改值”连接来分段控制
use this code and hookup at xib with "change the value" to segment controll