1

I'm based on this code:Custom MKAnnotationView with frame,icon and image

And I'm trying to do it a little different...I have an image non-transparent, and I want put an image inside. My problem is that the background image cover my image. So it looks something like: http://cl.ly/image/0E0S00072G1n

My code is so:

    annotationImageView.image = [UIImage imageNamed:@"marker_fb"];

    UIImage *frame = [UIImage imageNamed:@"marker_fb"];
    ImagePin *imagePinImage = annotation;   

    NSString *urlStringForImage = [NSString stringWithFormat:@"%@", imagePinImage.image];
    NSURL *urlForImage = [NSURL URLWithString:urlStringForImage];
    UIImageView *imageView = [[UIImageView alloc] init];

    [imageView setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", urlForImage]] placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"]];

    UIGraphicsBeginImageContext(CGSizeMake(annotationImageView.image.size.width, annotationImageView.image.size.height));
    [frame drawInRect:CGRectMake(0, 0, frame.size.width, frame.size.height)];
    [imageView.image drawInRect:CGRectMake(2, 2, 48, 38)]; // the frame your inner image

    annotationImageView.image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

Does z-indez exist in object-c? or how should I do?? Thanks. EDIT: I tried also with:

UIGraphicsBeginImageContextWithOptions(CGSizeMake(annotationImageView.image.size.width, annotationImageView.image.size.height), NO, 0);
Community
  • 1
  • 1
Riccardo Rossi
  • 161
  • 1
  • 9

0 Answers0