initWithFile()

Description

Creates a DcsImage object from a file.

Syntax

(id) initWithFile: (NSString *) filename

Parameters

filename:NSString * Specifies the file name to create the DcsImage from.

Return value

id

Remarks

For multi-page files like a multi-page tiff or PDF, it will create the object from the first page.

Exceptions

Circumstance Exception thrown
There is not enough memory. DcsMemoryLimitException
The file does not exist. DcsFileNotFoundException
It fails to read the file. DcsFileReadException
The data can't be decoded or the file is not an image. DcsDataFormatInvalidException
filename is nil. DcsValueNotValidException
filename is not String. DcsTypeNotValidException

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];

    DcsImage *DcsImg2 = [[DcsImage alloc]initWithFile:@"barcode"];
}

@end

Is this page helpful?

Leave a Reply

Your email address will not be published.