Your annotation needs to "know" what type it is so you can create the right kind of view in viewForAnnotation. Do so by subclassing MKPointAnnotation, adding an NSInteger value to it to store the array index.
See MKPointAnnotation add extra property, but you'll add an NSInteger property called index.
When creating your annotations, set this property:
for (int i = 0; i<arrayResults.count; i++)
{
object = [arrayResults objectAtIndex:i];
CLLocationCoordinate2D annotationCoord = CLLocationCoordinate2DMake([[[object coord]objectForKey:@"latitude"] floatValue], [[[object coord]objectForKey:@"longitude"] floatValue]);
// MKMyPointAnnotation is your MKPointAnnotation subclass
MKMyPointAnnotation *annotationPoint = [[MKMyPointAnnotation alloc] init];
annotationPoint.coordinate = annotationCoord;
annotationPoint.title = [NSString stringWithFormat:@"%@",[object nome_obj]];
annotationPoint.subtitle = [NSString stringWithFormat:@"%@",[object address]];
annotationPoint.index = i; // store the index
[map addAnnotation:annotationPoint];
}
Then in your viewForAnnotation, cast the annotation to your subclass, then dereference the type:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
{
MKMyPointAnnotation *myAnnotation = (MKMyPointAnnotation *)annotation;
object = [arrayResults objectAtIndex:myAnnotation.index]; // <-- your index property
switch ([[object iden] intValue])
{
case 1: // type one
.
.
.
}
.
.
.
}