iOS 11 public beta 9 : UITextField textcolor can't be changed when no keyboard

Viewed 559

I am developing an app which required to change text colour of UITextfield. I wrote following code for it.

-(IBAction)changedSegment:(UISegmentedControl *)segment{
    UIColor *color = arrColors[segment.selectedSegmentIndex];
    txtDemo.textColor = color;    
}

It is working fine in iOS 10. But in iOS 11 beta 9, when keyboard is hidden (resigned from responder), text color can't be changed.

1 Answers

Just add

[txtDemo setNeedsLayout];
Related