captureImage()

Description

Captures an image.

Syntax

- (void) 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 verification 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


@interface ViewController ()<DcsUIVideoViewDelegate>{
    DcsView *dcsView;
    UIButton *captureButton;
}
@end
 
@implementation ViewController
 
- (void)viewDidLoad {
    [super viewDidLoad];
    dcsView = [[DcsView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
 
    [self.view addSubview:dcsView];
    self.dcsView.currentView = DVE_VIDEOVIEW
    
    captureButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.center.x-100, self.view.center.y-20, 200, 40)];
    [captureButton setTitle:@"Capture Image" forState:normal];
    [captureButton setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    [captureButton addTarget:self action:@selector(captureImage) forControlEvents:UIControlEventTouchUpInside];
    [dcsView.videoView addSubview:captureButton];
}
- (void)captureImage{
    [dcsView.videoView captureImage];
}
@end
Is this page helpful?

Leave a Reply

Your email address will not be published.