1

I wish to add an image on top of a mapView the purpose of which is to calculate the area contained under that image. Having less or no experience in maps, I am not really sure how to go about it. So, here is what I used.

image = [UIImage imageNamed:@"Fla.png"];
img = [[UIImageView alloc] initWithImage:image];
img.userInteractionEnabled = YES;
img.backgroundColor = [UIColor clearColor];

img.contentMode =  UIViewContentModeCenter;
img.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

twoFingerPinch = [[UIPinchGestureRecognizer alloc]
                  initWithTarget:self
                  action:@selector(twoFingerPinch:)];
[img addGestureRecognizer:twoFingerPinch];
[self.mapView addSubview:img];

The image is being displayed fine and the pinch to zoom is working fine as well but the problem is the map stops responding as soon as the imageView is added. If I remove the imageView, the map works fine again.

Also came across this but didnt work for me.

Any help will be much appreciated.

Community
  • 1
  • 1
genaks
  • 757
  • 2
  • 10
  • 24

1 Answers1

0

Answering this so it helps those who make as silly a mistake as I did.

Make sure you do not set the frame of the imageView to cover the frame of the screen. In my case, this line killed me -

img.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
genaks
  • 757
  • 2
  • 10
  • 24