UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"......" message:@"......" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK", nil];
[alert show];
I am showing alert view to add a new category using through text field of alert view, when user tapes ok button of alert then I first check that if user has entered anything or not, if not then I show another alert with some message to let user know that text field is mandatory, but previous alert for adding new category disappears.
I want that alert to stay on the screen. So what Should I do ??
This is the crash report and code::
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add Vehicle Category" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK", nil];
alert.tag = 5;
txtAddVehicleCategory = [[UITextField alloc]initWithFrame:CGRectMake(12, 45, 260, 25)];
[txtAddVehicleCategory setBackgroundColor:[UIColor whiteColor]];
txtAddVehicleCategory.placeholder = @"Enter Vehicle Category";
txtAddVehicleCategory.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[alert addSubview:txtAddVehicleCategory];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, -50);
[alert setTransform:myTransform];
[alert show];
'NSInvalidArgumentException', reason: 'textFieldIndex (0) is outside of the bounds of the array of text fields'