textfield
click
-(void)viewWillAppear:(BOOL)animated{
[textfieldname addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
}
return Textfiled
color change
- (void)textFieldDidChange:(UITextField *)textfield{
CALayer *border = [CALayer layer];
CGFloat borderWidth = 2;
border.borderColor =[UIColor colorWithRed:111.0f/255.0f green:111.0f/255.0f blue:111.0f/255.0f alpha:1.0].CGColor;
border.frame = CGRectMake(0, textfield.frame.size.height - borderWidth, textfield.frame.size.width, textfield.frame.size.height);
border.borderWidth = borderWidth;
[textfield.layer addSublayer:border];
textfield.layer.masksToBounds = YES;
}
https://stackoverflow.com/a/15489967/9137841 check this it may be help you