相关疑难解决方法(0)

IOS Swift - 自定义相机覆盖

你好,我想在我的应用程序中打开相机

在此输入图像描述

我只想在该部分的中间打开一个摄像头,这样用户只能在矩形部分中拍摄

我正在使用的代码就是这个

import UIKit
import AVFoundation

class TakeProductPhotoController: UIViewController {

    let captureSession = AVCaptureSession()
    var previewLayer : AVCaptureVideoPreviewLayer?

    // If we find a device we'll store it here for later use
    var captureDevice : AVCaptureDevice?

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.
        captureSession.sessionPreset = AVCaptureSessionPresetHigh

        let devices = AVCaptureDevice.devices()

        // Loop through all the capture devices on this phone
        for device in devices {
            // Make sure this …
Run Code Online (Sandbox Code Playgroud)

camera ios swift

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

camera ×1

ios ×1

swift ×1