title: Custom segue after successful login
body: <p>I'm a beginner in iOS programming, so please don't kill me :]. I have application with authorization and when I successful authorize I would like go to second view. When authorization fails I show alert. My code for the authorization:</p>
  
  <pre><code>- (IBAction)LoginClick:(id)sender {
  
      for(User *user in self.allUsers){
          if([user.userName isEqualToString:self.usernameTextField.text] &amp;&amp; [user.password isEqualToString:self.passwordTextField.text]){
              // Logged in --&gt; go to second view (TableView)
              [self performSegueWithIdentifier:@"LoginSegue" sender:self];
          }
          else{
              // Wrong password or username
              Alerts *alert = [Alerts new];
              [alert showAlert:LOGIN_ERROR];
          }
      }
  }
  </code></pre>
  
  <p>I tried to look a simple way for custom transition (segue) to second view, when I successful log in, but I didn't find. Now I have this storyboard:</p>
  
  <p><a href="https://www.dropbox.com/s/dc8h4u920wgt47s/Screenshot%202014-03-03%2011.36.56.png" rel="nofollow">https://www.dropbox.com/s/dc8h4u920wgt47s/Screenshot%202014-03-03%2011.36.56.png</a></p>
  
  <p>And code for transition between View is:</p>
  
  <pre><code>[self performSegueWithIdentifier:@"LoginSegue" sender:self];
  </code></pre>
  
  <p>The result is error: </p>
  
  <p><em><strong></em>* Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'LoginSegue'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'</strong></p>
  
  <p>What is the problem? Why I need something like "Navigation controller". I need to create a class for segue? What is the simplest way to solve this problem? Thank you.</p>
  
  <p>EDIT ------- SOLUTION</p>
  
  <p>Thanks to all for help. I added navigation controller to my application as initial view. And I found, that use of a custom segue and making class for this custom segue is unnecessary. The simplest way for solution my problem is connect the ViewControllers (NOT BUTTON and second ViewController, so I had it first time...) and name the push segue. The name I used here in code:</p>
  
  <pre><code>- (IBAction)LoginClick:(id)sender {
  
      for(User *user in self.allUsers){
          if([user.userName isEqualToString:self.usernameTextField.text] &amp;&amp; [user.password isEqualToString:self.passwordTextField.text]){
              // Logged in --&gt; go to second view (TableView)
              [self performSegueWithIdentifier:@"LoginSegue" sender:self];
          }
          else{
              // Wrong password or username
              Alerts *alert = [Alerts new];
              [alert showAlert:LOGIN_ERROR];
          }
      }
  }
  </code></pre>
  
  <p>Concrete here: [self performSegueWithIdentifier:@"LoginSegue" sender:self];</p>
  
  <p>And all works great. When I login with correctly pass and username I'm redirected to second View.</p>