Set backgroundColor for UITextField in UITableViewCell

How can I programmatically change the backgroundColor of the UITextField that is in the UITableViewCell?

Setting UITextField.backgroundColor doesn't work.

+2


a source to share


2 answers


I had the same problem. I have combined it by creating my own UITextField and adding it to the UITableViewCell, but I'm not sure if there is a better way to do this.



+1


a source


Try this in the layoutSubviews method of this cell.



- (void)layoutSubviews {
    [super layoutSubviews];
    self.textLabel.backgroundColor = [UIColor blackColor];
}

      

+1


a source







All Articles