我希望用自定义图标替换 UITableViewCellAccessoryDetailButton 的图标。我试图用包含自定义图像的 UIButton 替换附件视图,但按钮显示为距单元格右边缘 20 个像素。
有没有更好的方法来替换图标,或者将附件视图一直向右移动?
我希望用自定义图标替换 UITableViewCellAccessoryDetailButton 的图标。我试图用包含自定义图像的 UIButton 替换附件视图,但按钮显示为距单元格右边缘 20 个像素。
有没有更好的方法来替换图标,或者将附件视图一直向右移动?
#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;
}
创建一个自定义单元格并在自定义单元格中创建 UIButton 并提供 UIButton 背景图像,如“DetailButton” 可能会对您有所帮助。