2011-12-29 86 views
3

我增加了标签,摄像头的覆盖和我成功添加它相机覆盖标签问题

但我所面对的标签也出现在拍摄照片的预览

我想要显示的在摄像头覆盖的标签没有添加标签的拍摄照片的预览我用下面的代码

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    [email protected]"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]; 

任何一个可以请帮我该怎么做的事...

回答

0

您需要根据叠加层尺寸裁剪图像。你可以尝试this tutorial这提供了一个很好的解释。

从iOS4.0开始,将从相机捕获的图像与其exif数据和旋转信息一起保存。因此,您不能像使用UIImage那样以标准方式裁剪它们。上面的链接特别涉及从相机捕获的图像。