mardi 12 juillet 2016

How do I configure the text field to account for the expiry date?


I am entering credit card information and I want the expiry date to be a max of 5 characters 4 numbers and a "/" automatically enters after the first two characters i.e. 01/17 after typing 01 the / is automatically entered, and allows only two more characters "17".

func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool
{
if textField == expire{

    }
    return true
}

Aucun commentaire:

Enregistrer un commentaire