【发布时间】:2014-07-01 03:39:22
【问题描述】:
我有一张桌子并按下一个单元格,我想查看相关的引脚,我该怎么做?
我有这个代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[_mapView selectAnnotation:[_mapView.annotations objectAtIndex:indexPath.row] animated:true];
}
问题是它打开了另一个不相关的引脚,我该怎么办?
【问题讨论】:
-
那么问题可能出在
_mapView.annotations数组或确保indexPath.row OR indexPath.section -
地图视图的
annotations数组的顺序不保证。见stackoverflow.com/questions/9539802/… 和stackoverflow.com/questions/13017305/…。 -
您的表格视图必须使用某些数据源。在该数据源中,您可以保留对相关注释对象的引用(或者您的数据源对象是注释)。
-
非常感谢!我有这个代码来解决它
标签: ios uitableview mkmapview mkannotationview