2010-12-09 210 views

回答

2

您可以覆蓋UITextField並在init方法中執行此操作。不過,我會強烈建議簡單地做創建後您的UITextField

textField.backgroundColor = [UIColor colorWithRed:0.2f green:0.3f blue:0.4f alpha:0.50001f]; 
1

要更改文本框的背景:

yourTextField.backgroundColor = [UIColor yellowColor]; 

要更改佔位符文本顏色:

[yourTextField setValue:[UIColor blackColor] forKeyPath:@"_placeholderLabel.textColor"];