Initialize Dynamsoft Camera View

In order to use functions of Dynamsoft Camera SDK iOS Edition, you need to initiate dcsView before using any methods and properties.


@interface ViewController () {
    DcsView *dcsView;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    //Please replace **** with your license key copied from the portal. 
    //Check http://developer.dynamsoft.com/dws/ios/How-to-set-license for more details.
    [DcsView setLicense:@"****"]; 

    dcsView = [[DcsView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

    // dcsView.videoView.delegate = self; 
    [self.view addSubview:dcsView];
}

@end
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)
}
}

How to set current view

The default current view is DVE_IMAGEGALLERYVIEW. You can use property currentView to set it to the other view.

self.dcsView.currentView = DVE_VIDEOVIEW;

Check related properties here (Swift, Objective-C).

Is this page helpful?

Leave a Reply

Your email address will not be published.