登录检查后执行Segue

pep*_*pep 2 iphone storyboard xcode4 ios5 segue

我对iphone的发展有些新意,所以请耐心等待!

我有一个登录屏幕,连接到我开发的REST API.它来回发送json请求.基本上,当您单击LOGIN时,它会检查用户名/密码是否有效(显然).

这是我所拥有的基本逻辑:

- (IBAction)sendLoginJson:(id)sender {

   // send JSON request to server.. etc

   NSURLConnection *myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
   [myConnection start]; 
}
Run Code Online (Sandbox Code Playgroud)

然后去

- (void)connectionDidFinishLoading
   // this is where I get the response from the server
Run Code Online (Sandbox Code Playgroud)

在确保正确验证登录后,如何切换到"DashboardViewController"?

谢谢!

Dar*_*ren 10

您可以手动执行segues.在故事板中创建segue时,不是按Ctrl +从按钮拖动到View Controller,而是从View Controller拖动到另一个View Controller.给segue一个名字,然后在你的代码中调用[self performseguewithidentifier @"seguename"]