【发布时间】:2014-08-31 00:08:35
【问题描述】:
这真的是一个n00b 的问题,我在尝试构建应用程序时正在学习iOS
我需要在UITableViewCell 上显示一张图片和标签。下面的代码为我做到了这一点
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.imageView.image = [self getImageNameForRow:indexPath.row];
cell.textLabel.text = self.features[(NSUInteger) indexPath.row];
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
return cell;
}
问题是图像尺寸比我预期的要大。所以我尝试将行的高度增加为
self.tableView.rowHeight = 80;
但随后图像也会按比例放大。
如何在增加(或更改)行大小的同时保持图像大小固定?
【问题讨论】:
标签: ios objective-c uitableview uiimageview