Reputation: 109
I have a different size of image to be input as a thumbnail of a tableview, is there a way to make all the image align despite their different in size? since in my case, the location of the text will follow the image, so it won't be neat. Here's the code that I use to input the image
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = title;
cell.textLabel.adjustsFontSizeToFitWidth = YES;
cell.imageView.image = thumb;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
Upvotes: 2
Views: 378
Reputation: 3410
Cell.imageView is a UIImageView, which is a subclass of UIView. Look at documentation of UIView - exactly "Configuring the Resizing Behavior". Maybe something of that helps.
But beware - resizing on the fly can reduce scrolling behaviour of the tableview. Maybe better way is to resize images to fit the size of the uiimageview before actually using them in tableview.
Upvotes: 1
Reputation: 44633
You can always set the frame of the imageView
and textLabel
objects as you want them to be.
Upvotes: 1