自定义单元格 - 更改自定义单元格中背景和按钮的颜色

时间:2014-10-17 20:14:21

标签: ios objective-c uitableview custom-cell

我有一个自定义单元格,我在iterfacebuilder中制作并连接到我的.h文件。

然后在我的CustomCell.m文件中

@implementation TwoMealsTableViewCell

@synthesize dayLabel, firstMealBtn, secondMealBtn, indexPath;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

    dayLabel.textColor = [UIColor orangeColor];

    if (self) {

        dayLabel.textColor = [UIColor orangeColor];


    }

    return self;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end

我在桌面视图中设置了所有单元格,我看到了按钮和标签,但是我没有看到颜色变化?

为什么会这样。

提前感谢您的帮助!!!

1 个答案:

答案 0 :(得分:0)

这将改变单元格颜色

dayLabel.textColor = [UIColor orangeColor];