I'd like to change the appearance of disabled textfields, i.e. text and background color - is there an easy and legal way to achieve this?
You could subclass your UITextfield and overwrite the enabled
property like this
- (void)setEnabled:(BOOL)enabled
{
[super setEnabled:enabled];
// Do your customization here, eg:
self.backgroundColor = [UIColor blackColor];
}
Swift version:
override var isEnabled: Bool {
willSet {
backgroundColor = newValue ? UIColor.white : UIColor.black
}
}