如何在 iPad 上的 iOS 7 上的 UITableView 单元格右侧绘制图像?
尝试并没有帮助以下代码:
tableView.contentInset = UIEdgeInsetsZero;
[cell contentView].frame = CGRectMake(0, [cell contentView].frame.origin.y, cell.frame.size.width, [cell contentView].frame.size.height);
如何在 iPad 上的 iOS 7 上的 UITableView 单元格右侧绘制图像?
尝试并没有帮助以下代码:
tableView.contentInset = UIEdgeInsetsZero;
[cell contentView].frame = CGRectMake(0, [cell contentView].frame.origin.y, cell.frame.size.width, [cell contentView].frame.size.height);
您很可能希望将accessoryView
属性设置在UITableViewCell
. 这将在单元格的右侧放置一个图像视图:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
// Configure cell
}
UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"<some image name>.png"]];
cell.accessoryView = image;
}