我想为所有单元格设置一种尺寸的 UIimageview,但是当单元格的大尺寸发生变化时,图像被更改我想要一种尺寸的 UIimage
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(!cell){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
cell.imageView.image = [UIImage imageNamed:@"England.png"];
cell.imageView.frame = CGRectMake( 2, 0, 25, 25 );
cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
UIFont * myfont = [UIFont fontWithName:@"Helvetica" size:13.0];
cell.textLabel.text = [_data objectAtIndex:indexPath.row];
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
cell.textLabel.textAlignment = UITextAlignmentCenter;
cell.textLabel.font = myfont;
cell.textLabel.textColor = [UIColor grayColor];
return cell;
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString * description = [_data objectAtIndex:indexPath.row];
CGSize size = [description sizeWithFont:[UIFont boldSystemFontOfSize:14.0f] constrainedToSize:CGSizeMake(190,40) lineBreakMode:UILineBreakModeWordWrap];
return size.height+50;
}