gpt4 book ai didi

mapkit - calloutAccessoryControlTapped 未调用/触发

转载 作者:行者123 更新时间:2023-12-03 18:00:23 35 4
gpt4 key购买 nike

我在我的应用程序中使用了这个例子,

http://spitzkoff.com/craig/?p=81

但它不会在我点击附件控件时调用/触发 calloutAccessoryControlTapped。

这是我的代码。

- (void)viewDidLoad {
MapAnnotation *annotation = nil;
annotation = [[MapAnnotation alloc] initWithCoordinate:[[trackPointsArray objectAtIndex:trackPointsArray.count - 2] coordinate]];
[mapView addAnnotation:annotation];
[super viewDidLoad];
}

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *annotationView = nil;

// start pin
static NSString *StartPinIdentifier = @"StartPinIdentifier";
MKPinAnnotationView *startPin = [annotationView dequeueReusableCellWithIdentifier:StartPinIdentifier];

if (startPin == nil) {
startPin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:StartPinIdentifier] autorelease];
startPin.animatesDrop = YES;
startPin.pinColor = MKPinAnnotationColorGreen;
startPin.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
startPin.canShowCallout = YES;
startPin.enabled = YES;

UIImage *image = [UIImage imageNamed:@"location.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
startPin.leftCalloutAccessoryView = imgView;
}

annotationView = startPin;
return annotationView;
}

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
NSLog(@"calloutAccessoryControlTapped");
}

我一直在为这个问题苦苦挣扎,似乎很多人也遇到了同样的问题。
任何帮助,将不胜感激。谢谢

最佳答案

问题解决了!
我的另一个 View 阻止了 map View 。
[self setUserInteractionEnabled:NO];

关于mapkit - calloutAccessoryControlTapped 未调用/触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1197533/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com