我想为UITableView单元格imageView设置边距或填充,我该怎么做? With heightForRowAtIndexPath
我只能设置行高。如果我增加它,它只是放大单元格中的图像。UITableViewCell imageView填充
这里是我的cellForRow方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellID = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID] autorelease];
cell.textLabel.numberOfLines = 1;
cell.textLabel.font = [UIFont systemFontOfSize:kSystemFontSize];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.textColor = [UIColor whiteColor];
}
cell.textLabel.text = [_dataArray objectAtIndex:indexPath.row];
cell.imageView.image = [UIImage imageNamed:[_imageArray objectAtIndex:indexPath.row]];
cell.backgroundColor = [UIColor clearColor];
return cell;
}
目前我只知道一个方法,我怎么能做到这一点 - 收缩使用Photoshop或similiar程序在同一时间停留,而图像的图像内容。但是这种方法会花费很多时间,我想应该有更简单的方法来做到这一点。
这是一个聪明的主意!顺便说一下,右侧表达式可以进一步简化为'CGAffineTransformMakeScale(0.5,0.5)'。 – Pang 2015-12-14 05:45:08
不适用于我。 – 2016-10-04 07:34:23