title: How to hide and unhide the UIAlertView.?
body: <p>I am opening an alert view when the view will appear. My alertview style is UIAlertViewStylePlainTextInput.I am saving the textfield text in NSUserDefaults. I want when the textfield have text in their textfield alert is not open But if the textfield is empty only then the alert is pop up on the screen.I am using the below code.<code>enter code here</code></p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
         proAlert = [[UIAlertView alloc]initWithTitle:@"Pro-Tracking Number" message:@"Firstly enter the protracking number here" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
      proAlert.alertViewStyle = UIAlertViewStylePlainTextInput;
      [proAlert show];
  }
  -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      if (buttonIndex==0)
      {
          proTextField.text = [[proAlert textFieldAtIndex:0]text];
      }
  
  }
   proTextField = [[UITextField alloc]initWithFrame:CGRectMake(170, 35, 150, 40)];
      proTextField.textColor=[UIColor blackColor];
      //proTextField.placeholder = @"Pro/Tracking no";
      NSUserDefaults *proNum = [NSUserDefaults standardUserDefaults];
      proTextField.text = [proNum valueForKey:@"proTracking"];
      [view2 addSubview:proTextField];
  -(void)viewWillAppear:(BOOL)animated
  {
      [activity stopAnimating];
  
      NSString *textString =[[proAlert textFieldAtIndex:0]text];
  
      [proTextField.text length];
  
  
      myText =textString;
      NSLog(@"Textfield text - %@",myText);
      NSUInteger length = [myText length];
  
  
  
      NSLog(@"LENGTH of string %lu",(unsigned long)length);
  
     if(myText&lt;0)
     {
         proAlert.hidden = NO;
           }
      else
      {
          proAlert.hidden = YES;
      }
  }
  </code></pre>