【问题标题】:TO navigate to other page when clicked on callout单击标注时导航到其他页面
【发布时间】:2012-03-05 13:48:49
【问题描述】:

各位,

我有一个要求,用户可以点击任何位置,它应该显示一个标注,当我们点击该标注时,它应该导航到其他页面。 如果您选择了某个位置,例如德里或那里的其他一些街道,它应该在所选区域中显示一个标注,当点击这个标注时,它应该将我导航到其他页面。

【问题讨论】:

  • 尝试正确解释问题。然后您可能会得到答案。

标签: iphone


【解决方案1】:

如果你想要callout click,请在Call Out (rightCalloutAccessoryView)中使用UIButton

在 MkMApViewDelegete 中使用此代码

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(Annotation *) annotation {

    if(annotation == map.userLocation) return nil;

    static NSString* AnnotationIdentifier = @"AnnotationIdentifier";


    MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc]
                                           initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
    customPinView.pinColor = MKPinAnnotationColorRed;
    customPinView.animatesDrop = YES;
    customPinView.canShowCallout = YES;

    UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightButton addTarget:self
                                    action:@selector(showDetails)
                forControlEvents:UIControlEventTouchUpInside];
    customPinView.rightCalloutAccessoryView = rightButton;

   
    return customPinView;


}


-(void)showDetails
{
//  go to detail page code ...use pushController
}

如果您有任何问题 请download这个代码(苹果)

【讨论】:

  • 它不工作...请给我总代码,因为我是新的 iphone 我无法得到这个。
  • 如何点击位置,这意味着用户应该点击那里的任何位置,它应该显示 pin .. 这在 iphone 中是否可行
猜你喜欢
  • 2023-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-24
  • 2020-01-01
  • 1970-01-01
  • 2018-07-17
  • 1970-01-01
相关资源
最近更新 更多