如何在iOS中打开带帧的相机

时间:2016-11-15 06:04:20

标签: ios objective-c iphone ipad camera

如何将iPhone相机绑定在图像下方的框架内。

enter image description here

  

让相机全屏打开但是阅读区域只是非模糊的背景,我希望开发一个图像显示的屏幕。

我已经尝试过这段代码,但它无效......

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
    picker.showsCameraControls = YES;
    picker.navigationBarHidden = YES;
    picker.view.frame = CGRectMake(0, 10, 200, 20); // NOT WORKING !!!
    picker.toolbarHidden = YES;
    picker.wantsFullScreenLayout = NO;
   // picker.delegate = delegate;

    CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0f, 50.0f);
    transform = CGAffineTransformScale(transform, 1.2f, 1.2f);
    picker.cameraViewTransform = transform;

    [self presentViewController:picker animated:YES completion:nil];

我该怎么做?

提前致谢!

1 个答案:

答案 0 :(得分:0)

您必须为此创建自定义相机。正如我在图像中看到的,您需要扫描条形码。为此你需要使用

  • AVCaptureSession
  • AVCaptureVideoPreviewLayer