title: UI AlertView - Storyboard
body: <p>I have two view controllers for login and registering in my app. I have created UIAlertViews to prompt the user when they haven't completed the field or there are problems with their details. However, when pressing ok on an AlertView, the app takes them to the next screen in storyboard despite any problems with their details. </p>
  
  <p>.m file for Sign-In view</p>
  
  <pre><code>#import "SignInViewController.h"
  #import &lt;Parse/Parse.h&gt;
  
  @interface SignInViewController ()
  
  @end
  
  @implementation SignInViewController
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
      // Custom initialization
      }
      return self;
  }
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view.
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)SignInAction:(id)sender {
      [PFUser logInWithUsernameInBackground:_UsernameField.text  password:_PasswordField.text block:^(PFUser *user, NSError *error) {
      if (!error) {
          NSLog(@"Login User!");
          [self performSegueWithIdentifier:@"signin" sender:self];
          _PasswordField.text = nil;
          _UsernameField.text = nil;
      }
      else {
          NSString *errorString = [[error userInfo] objectForKey:@"error"];
          UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
          [errorAlertView show];
      }
      }];
   }
  
  @end
  </code></pre>
  
  <p>This is the .m file for the LoginView</p>
  
  <pre><code>#import "LoginViewController.h"
  
  
  @interface LoginViewController ()
  
  @end
  
  @implementation LoginViewController
  @synthesize scroller;
  
  
  
  - (void)viewDidLoad
  {
  
      [super viewDidLoad];
  [scroller setScrollEnabled:YES];
      [scroller setContentSize:CGSizeMake(320, 600)];
  
  
  }
  
  
  - (void)viewDidAppear:(BOOL)animated {
  PFUser *user = [PFUser currentUser];
  if (user.username == nil){
      [self performSegueWithIdentifier:@"login" sender:self];
  
  }
  }
  
  - (void)didReceiveMemoryWarning
  {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)RegisterAction:(id)sender {
  [_FirstNameField resignFirstResponder];
  [_SurnameField resignFirstResponder];
  [_EmailField resignFirstResponder];
  [_PasswordField resignFirstResponder];
  [_ReenterPasswordField resignFirstResponder];
  [self checkFieldsComplete];
  
  [self checkFieldsComplete];
  }
  
  - (void) checkFieldsComplete {
  if ([_FirstNameField.text isEqualToString:@""] || [_SurnameField.text isEqualToString:@""]|| [_EmailField.text isEqualToString:@""] || [_PasswordField.text isEqualToString:@""] || [_ReenterPasswordField.text isEqualToString:@""])  {
      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops" message: @"Make sure to complete every field" delegate: nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
      [alert show];
  }
  
  else {
      [self checkPasswordsMatch];
  }
  
  }
  
  - (void) checkPasswordsMatch {
  if (![_PasswordField.text isEqualToString:_ReenterPasswordField.text]) {
      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops" message: @"Passwords don't match" delegate: nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
      [alert show];
  }
  else {
      [self registerNewUser];
  }
  }
  
  - (void) registerNewUser {
  NSLog(@"Registering...");
  PFUser *newUser = [PFUser user];
  newUser.username = _EmailField.text;
  newUser.email = _EmailField.text;
  newUser.password = _PasswordField.text;
  
  [newUser signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
      if (!error) {
          NSLog(@"Welcome to Vici!");
          [self performSegueWithIdentifier:@"login"
                                    sender:self];
      }
      else {
          NSLog(@"There was an error in registration");
      }
  }];
  }
  
  
  
  @end
  </code></pre>
  
  <p>Any help would be greatly appreciated. Have a good day.</p>