有没有方法设置UITableViewCell.图片显示在单元格的右边而不是左边?或者我是否需要在布局的右边添加单独的UIImageView? 原问题:UITableViewCell with image on the right?
Alex Wayne 不需要,但是你可以简单给表格单元格添加作为辅助视图的图像视图来获得同样的效果。 UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"foo.png"]]; cell.accessoryView = imageView; [imageView release]; user283846 这是给每个cell添加不同图片的方法,尝试一下。 // 自定义表视图单元格的外观 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } if(indexPath.row == 0) { cell.image = [UIImage imageNamed:@"image.png"]; } else if (indexPath.row == 1) { cell.image = [UIImage imageNamed:@"image1.png"]; } Camsoft 子类的UITableViewCell并且覆盖layoutSubviews ,然后调整self.textLabel, self.detailTextLabel 和 self.imageView views的框架。
Alex Wayne
不需要,但是你可以简单给表格单元格添加作为辅助视图的图像视图来获得同样的效果。
user283846
这是给每个cell添加不同图片的方法,尝试一下。
Camsoft
子类的UITableViewCell并且覆盖layoutSubviews ,然后调整self.textLabel, self.detailTextLabel 和 self.imageView views的框架。