【发布时间】:2012-03-05 13:48:49
【问题描述】:
各位,
我有一个要求,用户可以点击任何位置,它应该显示一个标注,当我们点击该标注时,它应该导航到其他页面。 如果您选择了某个位置,例如德里或那里的其他一些街道,它应该在所选区域中显示一个标注,当点击这个标注时,它应该将我导航到其他页面。
【问题讨论】:
-
尝试正确解释问题。然后您可能会得到答案。
标签: iphone
各位,
我有一个要求,用户可以点击任何位置,它应该显示一个标注,当我们点击该标注时,它应该导航到其他页面。 如果您选择了某个位置,例如德里或那里的其他一些街道,它应该在所选区域中显示一个标注,当点击这个标注时,它应该将我导航到其他页面。
【问题讨论】:
标签: iphone
如果你想要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这个代码(苹果)
【讨论】: