如何更改 iPhone 中 UITextField 的颜色?

Posted

技术标签:

【中文标题】如何更改 iPhone 中 UITextField 的颜色?【英文标题】:How to change color of UITextField in iPhone? 【发布时间】:2009-11-23 14:43:19 【问题描述】:

我已将UITextField 放置在UITableView 中,而我的UITableViewCell 颜色为 Yellow ,通常UITextField 的背景颜色为白色 我想将UITextField 的颜色更改为黄色或者它应该是透明的。 ..我用过

[txtfld setBackgroundColor:[UIColor clearColor]]; 

但它不起作用 - 文本字段显示为白色。

【问题讨论】:

【参考方案1】:

[txtfld setBackgroundColor:[UIColor yellowColor]]; 工作了吗?

【讨论】:

不,我试过这个,但这不起作用然后我使用 textview 而不是使用 textfield 然后出现光标向上滚动的问题。我还设置了 textview.scrollEnabled=NO;你能帮我解决这个问题吗

以上是关于如何更改 iPhone 中 UITextField 的颜色?的主要内容,如果未能解决你的问题,请参考以下文章