UIPickerController Image Offset with an ImageView overlay subview

139 views Asked by At

I am trying to overlay crosshairs in the camera, but after taking a picture, the image is offset from where it was taken. For example, I will line up the crosshairs with a lightbulb in my house, take the picture, and then the crosshairs will be around 20 pixels higher than the image. Here is my code for presenting the PickerController.

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;

UIImageView *overlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"crosshairs_img"]];
overlay.center = CGPointMake((self.view.bounds.size.width/2), overlay.center.y+195);
overlay.alpha = .6;
overlay.contentMode = UIViewContentModeCenter;
overlay.clipsToBounds = YES;
[picker.view addSubview:overlay];

[self presentViewController:picker animated:YES completion:nil];
0

There are 0 answers