iphone - 使用 Blue Marble Drop 在 Google/Apple map 上显示多个用户的位置

标签 iphone ios google-maps ios5 mapkit

所以我在这里需要做的是,我需要使用默认的蓝色大理石掉落在 map 上显示两个用户的位置。

任务是,用户 A 将每 5-10 秒将当前位置坐标上传到网络服务器,用户 B 将每 5-10 秒从那里提取该位置。因此,在 MKMapView 上,用户 B 将使用默认位置注释显示他自己的当前位置,但我还需要使用一些注释在用户 B 的 map View 上显示用户 A 的位置。

现在我无法使用图钉注释,因为位置每 5-10 秒更新一次。必须显示第二个用户的拉动位置的默认用户注释(蓝色大理石掉落),以便用户可以知道第二个用户的位置不是静态的,而是在移动的。引脚注释暗示该位置是静态的。

我怎样才能实现这一目标?

最佳答案

-(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;
}

Here is the BlueMarbleDrop.png

关于iphone - 使用 Blue Marble Drop 在 Google/Apple map 上显示多个用户的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12950326/

相关文章:

ios - 全屏相机

javascript - Google map HTMLMarker(循环不同位置)

google-maps - 如何重新定位 Google map Logo 和 map 按钮

ios - 定时循环结果

iphone - 通过触摸事件调整 UIButton 的大小

ios - 图层 slider - 框阴影窗口在 iPhone/iPad 上不起作用

ios - 使用 xib 中的自定义单元格在 UITableView 中动态行高

ios - 滑动手势的多个 Action

angular - Angular map 的 ZoomChange 或 centerChange 事件?

ios - iPhone:如何阅读运算符(operator)命令回复