【问题标题】:MKPointAnnotation: title always visible. Is it possible?MKPointAnnotation:标题始终可见。是否可以?
【发布时间】:2012-07-03 15:11:39
【问题描述】:

我添加标记和标题的代码是这样的:

MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = coord;
annotationPoint.title = currentTitle;
[mapView addAnnotation:annotationPoint];

是否可以在标记显示后立即在标记上显示标题并且始终可见? 非常感谢

【问题讨论】:

    标签: ios5 map mkmapview mkannotation mapkit


    【解决方案1】:
    MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
    annotationPoint.coordinate = coord;
    annotationPoint.title = currentTitle;
    [mapView addAnnotation:annotationPoint];
    [mapView selectAnnotation:annotationPoint animated:NO];
    

    - (void)mapView:(MKMapView *)map didAddAnnotationViews:(NSArray *)views{
    
        for (MKAnnotationView *av in views){
    
            if ([av.annotation isKindOfClass:[MKPointAnnotation class]]){
                [mapView selectAnnotation:av.annotation animated:NO];
                break;
            }
    
        }
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-27
      • 1970-01-01
      • 1970-01-01
      • 2015-07-05
      • 1970-01-01
      • 1970-01-01
      • 2015-09-12
      相关资源
      最近更新 更多