captureImage()

Description

Captures an image.

Syntax

func captureImage()

Parameters

None

Return value

Void

Remarks

Make sure the current camera is open before calling this method. You can open the camera via preview method.

Exceptions

onCaptureFailure is fired under the following circumstances to receive exceptions.

Circumstance Exception
License verfication failed. DcsLicenseVerificationFailedException
The capture mode is not DME_IMAGE. DcsOnlySupportedUnderImageModeException
The access to the camera is not authorized. DcsCameraNotAuthorizedException
The current camera is not open. DcsOperationSequenceExeption

Example

class ViewController: UIViewController{
    var dcsView:DcsView!
    override func viewDidLoad() {
        super.viewDidLoad()
        dcsView = DcsView(frame: CGRect(x:0,y:0,width:self.view.frame.size.width,height:self.view.frame.size.height))
        view.addSubview(dcsView)
        dcsView.currentView = DVE_VIDEOVIEW
        
        var captureButton = UIButton(frame:CGRect(x:self.view.center.x-100, y:self.view.center.y-20, width: 200, height: 40))
        captureButton.setTitle("Capture Image", for: .normal);
        captureButton.setTitleColor(UIColor.blue, for: .highlighted)
        captureButton.addTarget(self, action: #selector(captureImage), for: .touchUpInside)
        dcsView.videoView.addSubview(captureButton)  
    }
    func captureImage()
    {
        dcsView.videoView.captureImage()
    }
}
Is this page helpful?