I searched the net but have not found an answer. in my app i have a user registration, so i have to check the input text field before i accept the user.
here is my code:
- (IBAction)continueRegister:(id)sender {
if (!termsOfUseChecked)
NSLog(@"Error");
else
NSLog(@"Success");
if ([_regTelephoneNumber.text length] > 10) {
[self initWithTitle:@"error" andMessage:@"bla bla" andCancelButton:@"ok"];
}
if ([_regUserEmail.text rangeOfString:@"@"].location == NSNotFound){
[self initWithTitle:@"error" andMessage:@"bla bla" andCancelButton:@"ok"];
}
if (![_regPassword.text isEqualToString:_regConfirmPassword.text]) {
[self initWithTitle:@"error" andMessage:@"bla bla" andCancelButton:@"ok"];
}
}
-(void)initWithTitle:(NSString*)title andMessage:(NSString*)message andCancelButton:(NSString*)cancelButton;
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButton otherButtonTitles:nil, nil];
[alert show];
}
but if more than one error occurs the user get many pop ups. there is any way to show all the errors in the same UIAlertview?