I want leftCalloutAccessoryView have a location's own image, I know how to make a leftCalloutAccessoryView on callout bubble, however I couldn't get the image path
location information is init form a SpotAnnotation class, like bellow
- (id) initWithTitle:(NSString *)aTitle latitude:(CLLocationDegrees)aLat longitude:(CLLocationDegrees)aLon imageName:(UIImage *)imgName{
self.coordinate = CLLocationCoordinate2DMake(aLat, aLon);
self.currentTitle = aTitle;
self.places = [[NSMutableArray alloc] initWithCapacity:0];
self.image = imgName;
return self; }
In ViewController works like this
- (NSArray *) spots{
SpotAnnotation *s1 = [[SpotAnnotation alloc] initWithTitle:@"TaipeiZoo" latitude:25.039550 longitude:121.560265 imageName:[UIImage imageNamed:@"taipeiZoo.jpg"]];
SpotAnnotation *s2 = [[SpotAnnotation alloc] initWithTitle:@"Eslite" latitude:25.039720 longitude:121.565874 imageName:[UIImage imageNamed:@"Eslite.jpg"]]; }
biggest question is here -> initWithImage:
UIImageView *leftIconView = [[UIImageView alloc] initWithImage:"how can I get image path here"];
leftIconView.frame = CGRectMake(10, 10, 50, 50);
pin.leftCalloutAccessoryView = leftIconView;
ummm... I solved it..
problem is
initWithImage:((SpotAnnotation *)annotation).imageI will try hard to get it understand!