I have following code in my application:
// to set tip - photo in photo frame
NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:pathOfThumbNail]];
UIImage *cellThumbImg;
if([data length]>0){
cellThumbImg = [UIImage imageWithData:data];
} else {
cellThumbImg = [UIImage imageNamed:@"130X90.gif"];
}
UIImageView *imgView = [[UIImageView alloc]initWithImage:cellThumbImg];
imgView.frame = photoFrame;
[imgBg setContentMode:UIViewContentModeScaleToFill];
[cell.contentView addSubview:imgView];
//[cell.contentView sendSubviewToBack:imgView];
[imgView release];
[data release];
I want the following:
- Suppose an image ( which is loaded through nsdata ) is having size of 60 x 60 then content mode should be UIVIewContentModeCenter
- Suppose an image ( which is loaded through nsdata ) is having more size then 60 x 60 then content mode should be UIViewContentModeScaleToFill.
But my question is how can I determine the size of the image loaded through NSData
?