iOS 7-在MKMapView的UITableView子视图上滚动不工作
我有一个地图视图,向其中添加详图索引子视图。此子视图具有UITableViewController 当我尝试滚动此表时,地图会滚动 我尝试了其他视图而不是表视图,如按钮、开关或滑块,但似乎没有响应输入,所有输入都转到地图视图 添加子视图的代码如下所示:iOS 7-在MKMapView的UITableView子视图上滚动不工作,ios,objective-c,uitableview,ios7,mapkit,Ios,Objective C,Uitableview,Ios7,Mapkit,我有一个地图视图,向其中添加详图索引子视图。此子视图具有UITableViewController 当我尝试滚动此表时,地图会滚动 我尝试了其他视图而不是表视图,如按钮、开关或滑块,但似乎没有响应输入,所有输入都转到地图视图 添加子视图的代码如下所示: - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { CustomCallout *calloutView
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
CustomCallout *calloutView = (CustomCallout *)[[[NSBundle mainBundle] loadNibNamed:@"CustomCallout" owner:self options:nil] objectAtIndex:0];
CGRect calloutViewFrame = calloutView.frame;
calloutViewFrame.origin = CGPointMake(-calloutViewFrame.size.width/2 + 15, -calloutViewFrame.size.height);
calloutView.frame = calloutViewFrame;
[view addSubview:calloutView];
}
如何在CustomCallout内的表视图中启用滚动功能?您可以尝试在callout出现时禁用地图滚动功能,然后在地图消失后重新启用地图滚动功能:
mapView.scrollEnabled = NO;
我不确定这是否有效,但请尝试在tableview中的cellForRowAtIndexPath上执行类似操作:
for (int z=0; z<[theNumberOfRowsInYourTable]; z++) {
mapView.tag = z;
mapView = ((MKMapView *)[mapView viewWithTag:mapView.tag]);
}
或者像这样:
for (int z=0; z<[theNumberOfRowsInYourTable]; z++) {
mapView.tag = z;
mapView = ((MKMapView *)[mapView viewWithTag:mapView.tag]);
mapView.scrollEnabled = No;
}
for(int z=0;zI)我已经尝试过了,但是没有效果。地图保持静止,但是桌子不会对触摸做出响应。无论如何,谢谢你的回答。
for (int z=0; z<[theNumberOfRowsInYourTable]; z++) {
mapView.tag = z;
mapView = ((MKMapView *)[mapView viewWithTag:mapView.tag]);
mapView.scrollEnabled = No;
}