自定义的cell中,button不显示图片文字 求大神告诉我下

这是自定义的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;
}

解决了,用工厂方法创建自定义button,用方法设置title和image,别用点语法。我的设置方法不对。

能显示黄色的button,但就是没有图片和文字

你应该在cellForRowAtIndexPath中创建cell后,把你的按钮,图片等都addsubview添加进去
http://blog.csdn.net/totogo2010/article/details/7642908