1.创建cell

//    创建一个cell并且设置cell的风格

    UITableViewCell *cell  = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];

    CZHero *hero = self.heros[indexPath.row];

//给cell中的

    cell.textLabel.text = hero.name;

    cell.imageView.image = [UIImage imageNamed: hero.icon];

    cell.detailTextLabel.text = hero.intro;

//    设置附属物风格

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;

2.常用的属性

1)附属物风格属性

@property (nonatomic) UITableViewCellAccessoryType    accessoryType;              // default is UITableViewCellAccessoryNone. use to set standard type

也可以自定义附属物

@property (nonatomic, strong, nullable) UIView       *accessoryView;              // if set, use custom view. ignore accessoryType. tracks if enabled can calls accessory action

 

    cell.accessoryView = [UIButton buttonWithType:UIButtonTypeContactAdd];

效果