Monday, 22 April 2013

Password and Confirm Password in UITextField Xcode

You can write the code below on your button touch event of either sign up or login. This will check whether the strings/passwords written in both UITextFields are same or not and will prompt an alert message :

iif ([self.pwd.text isEqualToString:self.confirmpwd.text])
    {
        UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Message" message:@"successfully" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil];
        
        [alert show];
    }
    
    else
    {
        UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Message" message:@"Password mismatch" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        
        [alert show];
        
    }

No comments:

Post a Comment