Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think this is one of the best ways:</p> <pre><code>(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;) annotation { NSLog(@"welcome into the map view annotation"); MyAnnotation* myAnnotation1=annotation; // if it's the user location, just return nil. if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; if([mapView isEqual:mapMainView]== NO) { return nil; } // try to dequeue an existing pin view first // if ([annotation isKindOfClass:[myAnnotation1 class]]) // { // try to dequeue an existing pin view first static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; MKPinAnnotationView* pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier]; if (nil == pinView) { MKAnnotationView* annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease]; // annotationView.canShowCallout = YES; // pinView.animatesDrop=YES; //pinView.pinColor=MKPinAnnotationColorPurple; //image UIImage* flagImage = [UIImage imageNamed:@"map_marker_over2.png"]; CGRect resizeRect; resizeRect.size = flagImage.size; CGSize maxSize = CGRectInset(self.view.bounds, [MapPropertyViewController annotationPadding], [MapPropertyViewController annotationPadding]).size; maxSize.height -= self.navigationController.navigationBar.frame.size.height + [MapPropertyViewController calloutHeight]; if (resizeRect.size.width &gt; maxSize.width) resizeRect.size = CGSizeMake(maxSize.width, resizeRect.size.height / resizeRect.size.width * maxSize.width); if (resizeRect.size.height &gt; maxSize.height) resizeRect.size = CGSizeMake(resizeRect.size.width / resizeRect.size.height * maxSize.height, maxSize.height); resizeRect.origin = (CGPoint){0.0f, 0.0f}; UIGraphicsBeginImageContext(resizeRect.size); [flagImage drawInRect:resizeRect]; UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); annotationView.image = resizedImage; annotationView.opaque = NO; UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; rightButton.tag = myAnnotation1.tagAnnotation; annotationView.rightCalloutAccessoryView = rightButton; profileIconView = [[UIImageView alloc]initWithFrame:CGRectMake(18.5f, 10.0f, 37.0f, 30.0f)]; annotationView.leftCalloutAccessoryView = profileIconView; //image img = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:[arrImages objectAtIndex:myAnnotation1.tagAnnotation]]]]; NSLog(@"Annotation Click %d",[arrImages count]); NSLog(@"image %@",img); profileIconView.image=img; [profileIconView release]; [annotationView setEnabled:YES]; [annotationView setCanShowCallout:YES]; return annotationView; } return pinView; // } // return nil; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload