Parse platform 解析地图视图引脚
在我的应用程序中,我有一张地图,可以通过解析直接查看整个城市。现在我将使用不同的图像来识别它们。这些图像加载到我的数据库解析中。我怎样才能看到这些图像?感谢所有我希望我是清楚的。这是我的代码:Parse platform 解析地图视图引脚,parse-platform,mapkit,mkannotationview,Parse Platform,Mapkit,Mkannotationview,在我的应用程序中,我有一张地图,可以通过解析直接查看整个城市。现在我将使用不同的图像来识别它们。这些图像加载到我的数据库解析中。我怎样才能看到这些图像?感谢所有我希望我是清楚的。这是我的代码: - (void)viewDidLoad { [super viewDidLoad]; PFQuery *query = [PFQuery queryWithClassName:@"Citta"]; [query findObjectsInBackgroundWithBlock:^(NSArray
- (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];
}
}
}];
}
您可能应该提前下载所有pffile,以便在创建地图注释时,可以使用从下载的文件数据而不是按名称从静态图像加载图像来替换annotationView.image行。图像存储在pffile中?你没有解释你的代码有什么错误…是的,图像存储在PFFiles中,我想知道如何在地图上加载PFFile
- (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;
}