IOS: create UITextField e.g. WhatsApp TextField authentication code?

My problem is what I want to do UITextFieldas a WhatsApp textField validation code (as shown below). Where the default value contains the number of characters to be entered (as a hint to the user). When the user enters text, replace the hint character with the entered character one by one?

enter image description here

Any help is greatly appreciated.

+4
source share
2 answers

See the link below for my previous answer. I hope you understand how to do this. Only one UITextField, no third-party library uses.

- fooobar.com/questions/1647566/...

-

myLable textField, viewDidLoad()

self.myLable.userInteractionEnabled=true;
UITapGestureRecognizer *LongPressgesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPressgesture:)];
tapPressgesture.delegate=self;
[self.myLable addGestureRecognizer:tapPressgesture];

- (void)tapPressgesture:(UITapPressGestureRecognizer *)recognizer
{
    [self.txtField becomeFirstResponder];

}

, , backgroundField background image . UITextField border UITextBorderStyleNone - , .

:)

+1

6 .

-(BOOL)textFieldShouldReturn:(UITextField *)textField {

    return YES;
}


-(void)textFieldDidEndEditing:(UITextField *)textField{

    if (textField==textfield1)
    {

        [textfield1 resignFirstResponder];
        [textField2 becomeFirstResponder];


    }

    else if (textField==textfield2)
    {
        [textfield2 resignFirstResponder];
        [textField3 becomeFirstResponder];


    }


}

6

0

All Articles