【发布时间】:2014-01-16 09:26:32
【问题描述】:
我是 IOS 新手。我正在IOS中使用一个登录按钮制作登录视图控制器。当用户单击登录按钮时,可能会显示两个可能的view-controllers。我正在使用Storyboard,但我只能将一个 segue 分配给一个按钮。我不知道如何执行这个条件,因为我似乎没有 100% 控制 segue。
这是我的代码:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *stringreponse=[[NSString alloc] initWithData:_responseData encoding:NSUTF8StringEncoding];
// NSLog(@"Split response %@", [splitresponse objectAtIndex:0]);
if([stringreponse isEqualToString:@"0"])
{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Wrong username or password" message:@"Wrong username or password" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
else
{
NSArray *splitresponse=[stringreponse componentsSeparatedByString:@"#"];
if([[splitresponse objectAtIndex:0] isEqualToString:@"Parent"])
{
if([[splitresponse objectAtIndex:2] isEqualToString:@"yes"])
{
//seguechoice=@"showParentRegistration";
//[self performSegueWithIdentifier:@"showParentRegistration" sender:self ];
}else{
//seguechoice=@"showSohoDashboard";
}
}
}
}
【问题讨论】:
-
请打印
stringreponse结果。 -
通过 viewController 将 segue 分配给其他两个 viewController,并为这两个控制器中的每一个赋予两个不同的标识符,然后执行您想要的操作。
-
Thanx 想通了
标签: ios iphone objective-c segue xcode-storyboard