2

我希望用自定义图标替换 UITableViewCellAccessoryDe​​tailButton 的图标。我试图用包含自定义图像的 UIButton 替换附件视图,但按钮显示为距单元格右边缘 20 个像素。

有没有更好的方法来替换图标,或者将附件视图一直向右移动?

4

2 回答 2

4
#pragma mark Tableview Datasource and Delegate Method

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   UICollectionViewCell *Cell =(UICollectionViewCell*)[tableView dequeueReusableCellWithIdentifier:@"cell"];

 Cell.accessoryView = [[ UIImageView alloc ] 
                       initWithImage:[UIImage imageNamed:@"Something" ]];
return cell;
}
于 2016-02-17T05:49:09.860 回答
0

创建一个自定义单元格并在自定义单元格中创建 UIButton 并提供 UIButton 背景图像,如“DetailButton” 可能会对您有所帮助。

于 2016-02-17T05:11:29.070 回答