UIPickerController Image Offset with ImageView overlay subview

时间:2014-11-21 23:47:53

标签: ios cocoa-touch uipickerviewcontroller

我正在尝试在相机中叠加十字准线,但在拍摄照片后,图像会偏离拍摄的位置。例如,我将在家中用灯泡排列十字准线,拍摄照片,然后十字准线将比图像高出约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];

0 个答案:

没有答案