Objective c Set Left and right button in textfield

Set left button in textfield

+(void)setLeftButton :(UITextField *)textField Image:(UIImage *)image
{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,35, 20)];
    imageView.image = image;
    imageView.contentMode = UIViewContentModeCenter;
    
    textField.leftViewMode = UITextFieldViewModeAlways;
    textField.leftView = imageView;
}

Set right button in textfield

+(void)setRightButton :(UITextField *)textField Image:(UIImage *)image
{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,35, 20)];
    imageView.image = image;
    imageView.contentMode = UIViewContentModeCenter;
    
    textField.rightViewMode = UITextFieldViewModeAlways;
    textField.rightView = imageView;
}