分析MapView引脚



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

- (void)viewDidLoad {
[super viewDidLoad];

PFQuery *query = [PFQuery queryWithClassName:@"Citta"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    if (!error)
    {
        NSLog(@"QUERY -----> :%@", objects);

        for(NSMutableDictionary *note1 in objects) {
            float realLatitude1 = [[note1 objectForKey:@"Lat"] doubleValue];
            float realLongitude1 = [[note1 objectForKey:@"Lon"] doubleValue];
            NSLog(@"(PARSE) Lat: %f", realLatitude1);
            NSLog(@"(PARSE) Lon: %f", realLongitude1);

            MKPointAnnotation *displayMap = [[MKPointAnnotation alloc] init];
            CLLocationCoordinate2D theCoordinate;
            theCoordinate.latitude = realLatitude1;
            theCoordinate.longitude = realLongitude1;
            displayMap.coordinate = theCoordinate;
            displayMap.title = [note1 objectForKey:@"Nome_citta"];
            displayMap.subtitle = [note1 objectForKey:@"Nome_regione"];
            //displayMap.icon = [note1 objectForKey:@"icona"];
            [self.mapView setDelegate:self];
            [self.mapView addAnnotation:displayMap];

        }
    }
}];

}

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

{static NSString*falesieIdentifier=@"falesie";MKAnnotationView*annotationView=[self.mapView dequeueReusableAnnotationView WithIdentifier:falesieIdentifier];if(annotationView==nil){annotationView=[[MKAnnotationView alloc]initWithAnnotation:annotationreuseIdentifier:falesieIdentifier];

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

您可能应该提前下载所有的PFFiles,这样在创建地图注释时,您就可以用从下载的文件数据而不是从静态图像中加载图像来替换annotationView.image行。

最新更新