For alert2, Delegate is not called because you have not set the delegate.
Try making the following changes.
Alert1
UIAlertView * alert1 = [[UIAlertView alloc] initWithTitle:@"New Task"
message:nil
delegate:self
cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
alert1.alertViewStyle = UIAlertViewStylePlainTextInput;
alert1.tag = 101; //Add a Tag to the alert
[alert1 show];
Alert2 Alert 2 delegate is not set properly
UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:@"Congratulation!!!"
message:@"You have achieve Senior Level. "
delegate:self //Set your delegate
cancelButtonTitle:@"Cancel" otherButtonTitles:@"YES",nil];
alert2.tag = 102; //Add a different tag value to the second alert
data.leveljudge=1;
[alert2 show];
Delegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag == 101)
{
//Handle Alert 1
}
else if(alertView.tag ==102)
{
//Handle Alert 2
}
}