简体   繁体   English

相机叠加标签问题

[英]camera overlay label issue

i am adding a label to camera overlay and i successfully added it 我正在为相机叠加添加标签,我成功添加了它

but what i am facing is the label is also appearing in preview of the taken picture 但我所面对的是标签也出现在拍摄照片的预览中

i want to display the label in camera overlay not in preview of the taken picture for adding label i am using the following code 我想在相机覆盖中显示标签而不是在拍摄图片的预览中添加标签我使用以下代码

UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
overlayView.opaque = NO;
overlayView.backgroundColor = [UIColor clearColor];
[overlayView addSubview:topImgView];
[overlayView addSubview:btnInfo];
[overlayView bringSubviewToFront:btnInfo];

UILabel *label          =[[UILabel alloc]initWithFrame:CGRectMake(20, 0,290,150)];
 label.text              =@"Hold the bottle steady, left align the prescription label, and then take the photo";
 label.backgroundColor = [UIColor clearColor];
 label.numberOfLines = 2;
 label.textAlignment = UITextAlignmentCenter;
 label.font = [UIFont boldSystemFontOfSize:14.0];
 label.textColor = [UIColor whiteColor];
 [overlayView addSubview:label];
 _infoLabel  =label;
 [label release];


//Image picker
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.cameraOverlayView=overlayView;
[self presentModalViewController:imagePicker animated:YES]; 
_imagePicker =imagePicker;
[imagePicker release];
[topImgView release];
[overlayView release];

can any one please help me how to do that thing... 任何人都可以帮我怎么做那件事......

You need to crop the image based on your overlay dimensions. 您需要根据叠加尺寸裁剪图像。 You could try this tutorial which provides a good explanation. 您可以尝试本教程 ,它提供了一个很好的解释。

Beginning iOS4.0, the images captured from camera are saved along with their exif data and rotation information. 从iOS4.0开始,从相机捕获的图像与其exif数据和旋转信息一起保存。 So, you cannot crop them in the standard way as you would with the UIImage s The link above deals specifically with images captured from camera. 因此,您无法像使用UIImage那样以标准方式裁剪它们上面的链接专门处理从相机捕获的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM