How to Create Password validation in iOS? -
this question has answer here:
- password validation in uitextfield in ios 10 answers
i new ios, how create password validation in ios. in uitextfield allows numbers,one uppercase,lowercase , special characters. password length 8 characters. advance thank, examples.
if want validate password, in button click, mean after have typed password, , click button , want validation work---- how ---
create ibaction button---
-(void)validatewithbuttonclick:(id)sender{ nsstring *textfrompassword = _mypasswordtextfield.text; bool hasoneupper = no; bool hasonelower = no; bool hasonespecial = no; bool is8digit = no; if(pass.length >=8){ is8digit = yes; } (int =0; i<pass.length; i++) { char c1 = [pass characteratindex:i]; if([[nscharacterset uppercaselettercharacterset] characterismember:c1]){ hasoneupper = yes; continue; } else if ([[nscharacterset lowercaselettercharacterset]characterismember:c1]){ hasonelower = yes; continue; } else if ([[nscharacterset symbolcharacterset]characterismember:c1]){ hasonespecial = yes; continue; } } if(hasonespecial && hasoneupper && hasonelower && is8digit){ //validate password , progress.. } else { //your password not according guidelines } }
Comments
Post a Comment