init()

Description

Creates a DcsDocument object from UIImage.

Syntax

- (id) init: (UIImage*) image

Parameters

image:UIImage The image data to create object from.

Return value

ID

Remarks

When image is not nil, it will detect the boundary of the document and process it asynchorously. init will return immediately, in other words, it doesn't wait for the process to finish. At this time, isReady returns NO. When the process is done, isReady returns YES.

Exceptions

Circumstance Exception thrown
Image is nil DcsValueNotValidException
Some operations to DcsDocument are done before isReady turns true. DcsDocumentNotReadyException

Example


@interface ViewController () {
    DcsView *dcsView;
}
@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];

    UIImage *ImgIcon = [DcsImage imageNamed:@"ICON"];
    DcsDocument *DcsDocIcon = [[DcsDocument alloc]init:ImgIcon];
}

@end