Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
i need to see a good example of annotaion with image and detail disclosure.

secondly, i added text based annotaions around 500 of them, but i saw the map zooming erratically and sometimes not staying at particular annotation and hopping around annotations, is it a bug or there are better ways to handle this ?

regards
Jagat
 
500 is a bit much.. are you sure there isn't a better way? to add a segment, to only show special categorys, or within range, or something?
And if u checked documentation, you'd see there is a delegate method to define your own pins..

Code:
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation {
	MKAnnotationView *pinView = nil; 
        // try to dequeue an existing pin view first
        static NSString* CustomerAnnotationIdentifier = @"CustomId";
        MKAnnotationView* pinView = (MKAnnotationView *)
		[mapView dequeueReusableAnnotationViewWithIdentifier:CustomerAnnotationIdentifier];
        if (!pinView)
        {
            // if an existing pin view was not available, create one
            MKAnnotationView* customPinView = [[[MKAnnotationView alloc]
												initWithAnnotation:annotation reuseIdentifier:CustomerAnnotationIdentifier] autorelease];
			UIImage *pinImage = [UIImage imageNamed:@"intervention.png"];
			customPinView.image = pinImage;
			
			UIImageView *drIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"intervention.png"]];
            customPinView.leftCalloutAccessoryView = drIconView;
            [drIconView release];
			
            customPinView.canShowCallout = YES;
            
            return customPinView;
        }
        else
        {
            pinView.annotation = annotation;
        }
        return pinView;

Not sure if it's the best way to go, but it works for me :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.