开发者

set backgroundColor for UITextField within UITableViewCell

开发者 https://www.devze.com 2022-12-27 23:35 出处:网络
How can I programatically change the backgroundColor of an UITextField that sits in a开发者_开发问答 UITableViewCell?

How can I programatically change the backgroundColor of an UITextField that sits in a开发者_开发问答 UITableViewCell?

Setting the UITextField.backgroundColor doesn't seem to work.


I had the same problem. I sovled it by creating my own UITextField and adding it to the UITableViewCell, but im not sure if there's a better way to do it.


Try do it in layoutSubviews method of this cell.

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

精彩评论

暂无评论...
验证码 换一张
取 消