-1
我用下面的代码与“联系人”实体绑定注释
//add each object in Contacts entity to map view
NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Contacts" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:nil];
for (NSManagedObject *info in fetchedObjects) {
NSLog(@"Name: %@", [info valueForKey:@"name"]);
//initializetion latitude and longitude
aLng=[[info valueForKey:@"lng"] doubleValue];
aLat=[[info valueForKey:@"lat"] doubleValue];
//if latitude and longitude not null
if(aLng && aLat && aLng!=0.0 &&aLat!=0.0)
{
//create a new Coordinate
CLLocationCoordinate2D wimLocation;
wimLocation.latitude=aLat;
wimLocation.longitude=aLng;
//create a new Annotation and initializetion it
MKPointAnnotation * myAnnotation=[MKPointAnnotation alloc];
myAnnotation.coordinate=wimLocation;
myAnnotation.title=[info valueForKey:@"name"];
//add create Annotation to mapview
[self.mapview addAnnotation:myAnnotation];
}
}
及其工作在地图结合诠释得很好,但我有问题1 - 我想显示
[UIImage imageWithData:[info valueForKey:@"photo"]]
而不是销的图像2 - 我怎样才能选择在地图上的接点(注释)做一些动作
请把你的答案根据我的代码,它只显示一张照片,我想显示所有信息照片 – 2014-12-05 20:45:47