相机叠加标签问题

时间:2011-12-29 06:03:13

标签: iphone ios ios4

我正在为相机叠加添加标签,我成功添加了它

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

我想在相机叠加层中显示标签而不是在拍摄图片的预览中添加标签我使用以下代码

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];

任何人都可以帮我解决这个问题......

1 个答案:

答案 0 :(得分:0)

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

从iOS4.0开始,从相机捕获的图像与其exif数据和旋转信息一起保存。因此,您无法像标准UIImage那样以标准方式裁剪它们。上面的链接专门处理从相机拍摄的图像。