UITextField text colour goes invisible when editing - is this a bug?
I have a UITableView which is set up to resemble drawing on a blackboard. The cells contain a UITextField which has the textColor
property set to a pattern image:
textField.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"chalkTexture.png"]];
This all works fine. However, the cell is editable in-place, and doin开发者_Python百科g this makes the text invisible! I have removed all possible background items so I know it isn't being overlapped by anything, or drawing black on a black background, for example.
I can "solve" the problem by changing the text colour in my delegate methods like so:
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
textField.textColor = [UIColor whiteColor];
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
textField.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"chalkTexture.png"]];
}
This doesn't look too bad and does emphasise the cell that is being edited, but I'd like to keep the textured colour for my text. Is this a bug or intentional behaviour?
精彩评论