这是自定义的cell
- (UIButton *)categoryBtn{
if (!_categoryBtn) {
_categoryBtn = [[UIButton alloc]init];
_categoryBtn.backgroundColor = [UIColor yellowColor];
_categoryBtn.titleLabel.text = @"111111";
[_categoryBtn setTintColor:[UIColor blackColor]];
_categoryBtn.imageView.image = [UIImage imageNamed:@"btn_block_remove_n"];
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self.contentView addSubview:self.categoryBtn];
[self.categoryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
}
return self;
}
cellforrow方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
return cell;
}