Reputation: 111
I am using:
NSString *thearticleImage = entry.articleImage;
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))" options:NSRegularExpressionCaseInsensitive error:NULL];
NSString *someString = thearticleImage;
self.theurl = [someString substringWithRange:[expression rangeOfFirstMatchInString:someString options:NSMatchingCompleted range:NSMakeRange(0, [someString length])]];
NSURL *picimage = [NSURL URLWithString:theurl];
NSData * urlData = [NSData dataWithContentsOfURL: picimage];
UIImage * imageweb = [UIImage imageWithData: urlData];
cell.imageView.frame = CGRectMake(0, 0, 70, 70);
cell.imageView.image = imageweb;
The problem is that this takes up the entire cell, and I'm not for sure why it is not just in the left hand side.
Upvotes: 4
Views: 1701
Reputation: 130193
I ran into a similar problem with my table cell images. I used the following to scale the images:
UIImage *imageOne = [UIImage imageNamed:[imagesArray objectAtIndex:indexPath.row]];
cell.imageView.image = [UIImage imageWithCGImage:imageOne.CGImage scale:imageOne.size.width/40 orientation:imageOne.imageOrientation];
NOTE: consider "40" above to be a representation of how many pixels wide you want the image to be.
Upvotes: 5
Reputation: 1740
Since you don't say where the imageview is created (code or IB) my guess is you created an ImageView in IB for that particular cell which is trumping the frame you are setting in the code.
Upvotes: 1