-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