首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Blue Marble Drop在Google/Apple地图上显示多个用户的位置

使用Blue Marble Drop在Google/Apple地图上显示多个用户的位置
EN

Stack Overflow用户
提问于 2012-10-18 16:32:47
回答 1查看 589关注 0票数 0

默认用户注释(蓝色大理石下降)必须显示第二个用户的拉动位置,以便用户可以获得第二个用户的位置不是静态的,而是在移动中。Pin Annotation类建议该位置是静态的。

我怎样才能做到这一点呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-18 17:32:29

代码语言:javascript
复制
-(void)updateLocation
{// this will update your location
    NSString *latitude = @"0.0";
    NSString *longitude=@"0.0";
    MyAnnotation *ann = [[MyAnnotation alloc] initWithLatitude:latitude Longitude:longitude];
    [self.theMapView removeAnnotations:[self.theMapView annotations]];
    [self.theMapView performSelectorOnMainThread:@selector(addAnnotation:) withObject:ann waitUntilDone:YES];

    MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.1f, 0.1f));
    [self.theMapView setRegion:region];

}

- (MKAnnotationView *) mapView:(MKMapView *)mapView1 viewForAnnotation:(id <MKAnnotation>) annotation{

    // if it's the user location, just return nil.
    if ([annotation isKindOfClass:[MKUserLocation class]])
        return nil;
    // try to dequeue an existing pin view first
    static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
    MKAnnotationView *pinView = [[MKAnnotationView alloc]
                                  initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
    pinView.image = [UIImage imageNamed:@"BlueMarbleDrop"];

    pinView.annotation = annotation;
    return pinView;
}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12950326

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档