Tag: 标注

使用button创build自定义调用视图

我被困在一个地图查看问题,我在过去三天上网冲浪,但仍没有find任何适当的解决scheme。 我的问题是当我点击我自己定制的针脚时,会出现一个标注。 但标准的标注只支持两行文本。在我的情况下,我必须显示一个button四行文本。 请任何人告诉我如何创build一个自定义标注或应该使用什么方法,因为没有办法修改标准标注。 任何build议将不胜感激。 提前致谢。

注释标注标题不会更改

我已经搜查,但我没有find任何解决我的问题。 我想改变已经添加的引脚。 这是我的代码。 我在控制台中看到“Code Here”。 我在.h – (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)annotationView; myViewController.m – (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)annotationView { userPins *myAnnot = (userPins *)annotationView.annotation; [myAnnot setTitle:@"o21"]; NSLog(@"Code here!"); } – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"userPins"; if ([annotation isKindOfClass:[userPins class]]) { MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (annotationView == […]

为当前位置注释设置canShowCallOut = NO

我为当前位置图标使用自定义调用(标题和副标题)。 我试图closures默认注释,但它不起作用。 – (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { NSLog(@"viewForAnnotation"); if ([annotation isKindOfClass:[MKUserLocation class]]) { MKAnnotationView *userLocationView = [mapView viewForAnnotation:annotation]; userLocationView.canShowCallout = NO; NSLog(@"[annotation isKindOfClass:[MKUserLocation class]"); return nil; } } 唯一的办法是 -(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)ann { if([ann.annotation isKindOfClass:[MKUserLocation class]] ) { [mymap deselectAnnotation:ann.annotation animated:NO]; } } 但它有时滞后。 有没有其他的方法来禁用当前位置注释的默认标注视图? 任何帮助将不胜感激。

iOS区分哪个标注配件是轻拍的

在我的地图注释中,我有一个UIButton作为标注中的每个附件视图。 在- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control方法,我怎么知道哪个附件视图被处理过每个事件? 这是我的代码: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"]; UIButton *calloutButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; UIButton *directionsButton = [UIButton buttonWithType:UIButtonTypeCustom]; directionsButton.frame = CGRectMake(0, 0, 23, 23); [directionsButton setBackgroundImage:[UIImage imageNamed:@"directions.png"] forState:UIControlStateNormal]; MyPin.leftCalloutAccessoryView = directionsButton; MyPin.rightCalloutAccessoryView = calloutButton; MyPin.draggable = NO; MyPin.highlighted […]

在这种情况下,mapView:viewForAnnotation:将被调用?

现在我想在我的iOS应用程序的地图上添加一个静态的引脚注释。 但我只想知道是否将调用委托方法mapView:viewForAnnotation:。 在苹果文档中,据说 When it needs an annotation view, the map view calls the mapView:viewForAnnotation: method of its delegate object. 我从互联网上阅读了几个教程,并从苹果官方文档中看到了这些教程 而且我还是不会在这个方法被调用的时候。

如何以编程方式打开调用MKAnnotationView? (iPhone,MapKit)

我想以编程方式打开MKPinAnnotationView的标注。 例如,我在地图上放下10个针脚,并且想打开离我最近的那个针脚。 我怎么去做这个? 苹果已经为MKAnnotationView's指定了“selected”参数,但不鼓励直接设置它(这是行不通的,试过了)。 对于其余的MKAnnotationView只有一个高亮的( 同样的故事 ),并且可以ShowCallout方法。 任何提示,如果这是可能的呢?

用button自定义MKAnnotation标注泡泡

我正在开发应用程序,其中用户通过GPS进行本地化,然后询问他是否位于特定位置。 为了证实这一点,标注泡沫马上提交给他,问他,如果他在特定的地方。 由于有很多类似的问题,我可以做自定义标注泡泡: 我的问题:button不是“可点击”我的猜测:因为这个自定义标注高于标准标注泡泡,我不得不把它放在负面的“框架”,因此button不能被点击。 这是我的didSelectAnnotationView方法 – (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { if(![view.annotation isKindOfClass:[MKUserLocation class]]) { CalloutView *calloutView = (CalloutView *)[[[NSBundle mainBundle] loadNibNamed:@"callOutView" owner:self options:nil] objectAtIndex:0]; CGRect calloutViewFrame = calloutView.frame; calloutViewFrame.origin = CGPointMake(-calloutViewFrame.size.width/2 + 15, -calloutViewFrame.size.height); calloutView.frame = calloutViewFrame; [calloutView.calloutLabel setText:[(MyLocation*)[view annotation] title]]; [calloutView.btnYes addTarget:self action:@selector(checkin) forControlEvents:UIControlEventTouchUpInside]; calloutView.userInteractionEnabled = YES; view.userInteractionEnabled = YES; [view addSubview:calloutView]; } […]