NSData initWithData
- (id)initWithData:(NSData *)data
Parameters
data
A data object.
Return Value of [NSData initWithData]
A data object initialized with the contents data. The returned object might be different than the original receiver.
NSData initWithData example.
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"Pacific_Map" ofType:@"png"];
NSURL* urlEx = [NSURL fileURLWithPath:imagePath];
NSData* mapExIMGData = [[NSData alloc] initWithContentsOfURL: urlEx];
UIImage* imgEx = [[UIImage alloc] initWithData:mapExIMGData];
mapImageViewEx.image = imgEx;
NSURL* urlEx = [NSURL fileURLWithPath:imagePath];
NSData* mapExIMGData = [[NSData alloc] initWithContentsOfURL: urlEx];
UIImage* imgEx = [[UIImage alloc] initWithData:mapExIMGData];
mapImageViewEx.image = imgEx;