Jan*_*ski 5 mapkit mkmapview ios
我正在将我的应用程序(MyWorld)更新到iOS 7.该应用程序的一个功能是您可以在地图视图上拖动图钉.它似乎在iOS7中被打破了.
重新创建问题的步骤:
每当我滚动地图视图时,注释都会随地图一起移动.它似乎没有附加到右视图或图层?如果引脚没有被拖动,则地图视图似乎工作正常并且注释保持在定义的位置.我想知道这是我的错误还是已知问题?
我创建了一个虚拟的MapViewTest项目,用于说明github上的问题:https://github.com/DJMobileInc/MapViewTest
小智 18
这是来自MKAnnotationView类参考,用于MKAnnotationViewDragStateNone常量:
MKAnnotationViewDragStateNone
视图不参与拖动操作.拖动结束或取消时,注释视图负责将自身返回到此状态.
要解决此问题,地图视图委托将需要在注释结束或取消其拖动操作时将注释视图的dragState设置回MKAnnotationViewDragStateNone.
例如:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView
didChangeDragState:(MKAnnotationViewDragState)newState
fromOldState:(MKAnnotationViewDragState)oldState
{
if (newState == MKAnnotationViewDragStateEnding) {
// custom code when drag ends...
// tell the annotation view that the drag is done
[annotationView setDragState:MKAnnotationViewDragStateNone animated:YES];
}
else if (newState == MKAnnotationViewDragStateCanceling) {
// custom code when drag canceled...
// tell the annotation view that the drag is done
[annotationView setDragState:MKAnnotationViewDragStateNone animated:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4931 次 |
| 最近记录: |