解析MapView引脚

时间:2015-11-13 09:35:43

标签: parse-platform mapkit mkannotationview

在我的应用程序中,我有一张地图,我可以直接通过Parse查看所有城市。现在我将使用不同的图像来识别它们。这些图像加载到我的数据库Parse上。我怎么能看到这些图像?感谢所有我希望我很清楚。这是我的代码:

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

}

    annotationView.image = [UIImage imageNamed:@"marker.png"];

    annotationView.canShowCallout = YES;




   // UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

    UIImageView *carView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"UITableNext"]];

    UIButton *blueView = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 44+30)];
    blueView.backgroundColor = UIColorFromRGB(0xffffff);
    [blueView addTarget:self action:@selector(prepareForSegue:sender:) forControlEvents:UIControlEventTouchUpInside];
    carView.frame = CGRectMake(23, 19, carView.image.size.width, carView.image.size.height);
    [blueView addSubview:carView];

    annotationView.rightCalloutAccessoryView = blueView;
        }



        return annotationView;
    }

{     static NSString * falesieIdentifier = @&#34; falesie&#34 ;;     MKAnnotationView * annotationView = [self.mapView dequeueReusableAnnotationViewWithIdentifier:falesieIdentifier];     if(annotationView == nil){         annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation                                                       reuseIdentifier:falesieIdentifier];

 <script type="text/javascript">
    var isOnline = navigator.onLine;
    if (!isOnline)
        alert("Your custom message for no internet connectivity!!!");
</script>

1 个答案:

答案 0 :(得分:0)

您应该提前下载所有PFFiles,这样当您创建地图注释时,您可以将annotationView.image行替换为从下载的文件数据加载图像,而不是按名称从静态图像加载。 / p>