Search code examples
iphonexcode4ios5storyboardsegue

Perform Segue after login check


I'm somewhat new to iphone development.. so please bear with me!

I have a login screen that connects to my REST API I developed. It sends json requests back and forth. Basically when you click LOGIN, it checks whether the username/password was valid (obviously).

Here's the basic logic of what I have:

- (IBAction)sendLoginJson:(id)sender {

   // send JSON request to server.. etc

   NSURLConnection *myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
   [myConnection start]; 
}

Then goes to

- (void)connectionDidFinishLoading
   // this is where I get the response from the server

How do I switch to, say, "DashboardViewController" after I make sure the login was verified correctly?

Thanks!


Solution

  • You can manually perform segues. When you create a segue in the storyboard, instead of Ctrl+Dragging from a button to a View Controller, drag from the View Controller to another View Controller. Give the segue a name, then in your code you call [self performseguewithidentifier@"seguename"]