如何使用segue导航?

我必须导航到button点击使用segue下一个屏幕,但条件是我打电话给一个Web服务,如果从Web服务的结果是成功的,它应该导航,否则停留在login屏幕。 但使用下面的代码,它只是导航..

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if([[segue identifier] isEqualToString:@"loginbutton"]) { [self.sharedController setLoginDetailsDyanamic1:_strUsername.text password:_strPassword.text delegate:self]; if ([[dictresult objectForKey:@"Response"] isEqual: @"Success"]) { DashBoardViewController *obj = [[DashBoardViewController alloc]init]; [self.navigationController pushViewController:obj animated:YES]; } } } //delegates -(void)controllerDidFinishLoadingWithResult:(id)result; { dictresult = result; NSLog(@" result ----- :%@",dictresult); NSLog(@" result of key----- :%@",[dictresult objectForKey:@"Response"]); // if ([[result objectForKey:@"Response"] isEqual: @"Success"]) // { // DashBoardViewController *obj = [[DashBoardViewController alloc]init]; // [self.navigationController pushViewController:obj animated:YES]; // // } } -(void)controllerDidFailLoadingWithError:(NSError*)error; {} The result that i get in -(void)controllerDidFinishLoadingWithResult:(id)result is: 

结果—–:{回应=成功; 令牌= 2e8c0ef66a5ac15b8f61da080c26d056218a6172; errorCode = 0; }

我如何pipe理这个? 我用下一个视图连接了我的button。

你必须在故事板上设置一个Segue标识 ,然后使用这一行代码来判断下一个视图控制器。

  [self performSegueWithIdentifier:@"SegueIdentity" sender:self]; 

在这里输入图像说明