【发布时间】:2014-07-12 12:11:03
【问题描述】:
我必须使用 segue 在按钮单击时导航到下一个屏幕,但条件是我调用 Web 服务,如果 Web 服务的结果是 SUCCESS,它应该导航,否则留在登录屏幕中。但是使用下面的代码它只是导航..
-(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; 错误代码 = 0; }
我该如何管理?我已将按钮与下一个视图关联。
【问题讨论】:
标签: ios iphone objective-c