Can't change multiple textfield colors in iOS 11 GM

Viewed 477

Working on iOS 10.3 simulator, but not on iOS 11 until you tap the textfield.

Hierarchy:

view hierarchy

Example code below.

#import "ViewController.h"

@interface ViewController ()
@property (nonatomic) UITextField *textField1;
@property (nonatomic) UITextField *textField2;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 50, 50, 30)];
    textField.borderStyle = UITextBorderStyleLine;
    [self.view addSubview:textField];
    self.textField1 = textField;

    UITextField *textField2 = [[UITextField alloc] initWithFrame:CGRectMake(0, 100, 50, 30)];
    textField2.borderStyle = UITextBorderStyleLine;
    [self.view addSubview:textField2];
    self.textField2 = textField2;

    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 200, 50, 50)];
    button.backgroundColor = [UIColor blueColor];
    [button addTarget:self action:@selector(changeColor) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:self.textField1];
    [self.view addSubview:self.textField2];
    [self.view addSubview:button];
}

- (void)changeColor
{
    self.textField1.textColor = [UIColor greenColor];
    self.textField2.textColor = [UIColor greenColor];
}
1 Answers
Related