1

我试图在相机中叠加十字准线,但在拍照后,图像与拍摄位置发生了偏移。例如,我会将十字准线与我家的灯泡对齐,拍照,然后十字准线会比图像高 20 像素左右。这是我展示 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];
4

0 回答 0