I want to be able to set the color inside a Text Field to be a different color than the default white.
I can make it grey by reducing the Alpha value but i want to use colors other than gray to denote certain conditions. i.e. red for a warning.
I hate asking such a simple question but I did some Google Searches and don't see anything to give me some insight.
I want to use colors, not an image as that would be more efficient than using images. But if it only works with images then guidance on that would be great.
I know there is a Background image you can set but that is more to make the border a different color. I want the color inside the text field area to be a different color.
If there is a way to do this in code but not in IB, that would be useful for me as well.
Thanks,
Dano
You can change the background color within the Text Field attributes under the "view" tab in Interface Builder.
Note that the setting for "Background" setting for changing the background color is well hidden at the bottom of all the settings, unlike the "Background" setting for setting a background image, which is right at the top of the screen.
To change the background color in IB, set the Border to other than round rect.
Programmatically:
UITextField *myTextField;
myTextField.borderStyle = UITextBorderStyleNone;
myTextField.backgroundColor = [UIColor redColor];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With