单击pin mapkit后转到另一个viewcontroller

时间:2013-06-14 15:42:47

标签: ios6 mapkit

我的地图上有多针(关于餐馆,酒店等......),在那些针脚上我有一个“箭头”(rightcalloutaccessoryview)。坐标存储在sqlite数据库中。

当我点击针脚时,我可以获得坐标和正确的ID,然后我正在检查DB在哪里是坐标。

目标:当我点击酒店别针时,我想去那个细节ViewController(加载那个酒店的id)

任何想法?

1 个答案:

答案 0 :(得分:1)

是尝试下面的示例代码。在这里,我曾经用它来区分注释(pin)。并使用了地图视图委托方法

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
   calloutAccessoryControlTapped:(UIControl *)control
{
    NSLog(@"accessory button tapped for annotation %@", [view.annotation title]);

    if([[view.annotation title] isEqualToString:@"one"])
    { 
           // Push to another view controller code here
    }
}