Custom Pin Password Boxes on iOS
I want to create a 4 character custom password entry like the iPhone lock screen pa开发者_如何学运维ge. It's going to have a custom designed keyboard pinpad, but thats not the question. I have 4 boxes for the entry of the pin, and each box is separated and has its own custom design. I currently have a clear UITextView on top of each box. However, I'm not really sure how to link all these together so that when I enter a number in the first box, it automatically advances to the next box so I can type the next number. After the last number has been entered, it should automatically check to see if the password is correct and if so do some action. What is the best way to do this?
When implementing UITextFieldDelegate you should check on textField:shouldChangeCharactersInRange:replacementString:
and you can move keyboard focus to next UITextField via BecomeFirstResponder
documentation
So on last UITextField you will hide keyboard and disable all UITextboxes automatically, but If I were you, I would prefer to provide button to start checking pin (to let user correct pin if mistyped)
精彩评论