【发布时间】:2011-10-21 07:43:27
【问题描述】:
我的一个视图中有一个 MKMapView,上面有一些注释。还有一个隐藏的 UITableView,每个单元格显示每个注释的详细信息。当用户选择某个注释时,会出现 tableView 并选择特定的单元格。此外,当用户选择一个单元格时,特定的注释也会被选中。
I want the view to have the following behavior: when an annotation is selected and the user taps the map the tableView will disappear but when the user selects another annotation the tableView will stay visible and changes the selected index.
问题在于didDeselectAnnotationView 方法。它在didSelectAnnotationView 之前被调用,所以在您要检查的方法中:
- (void)mapView:(MKMapView *)mapview didSelectAnnotationView:(MKAnnotationView *)view
{
if([mapView.selectedAnnotations count] == 0)
[self hideTableView];
}
目前没有选中的注解,tableView 总是被隐藏。
我的问题是didDeselectAnnotationView 是否有办法区分点击的地图和选择另一个注释。
另外,有什么解释为什么在 iPhone 3G(4.2.1) 中didDeselectAnnotationView 在didSelectAnnotationView 之后被调用?看起来很奇怪!
提前谢谢你!
【问题讨论】:
标签: objective-c ios xcode uitableview mkmapview