【发布时间】:2012-07-11 06:00:22
【问题描述】:
我的应用中只有两个 ViewController
故事板设置:-
我有一个从我的ViewController 直接连接到 MainTableViewController 的推送 segue。我希望我的应用在用户输入正确的密码后立即重定向到主视图。
这是我的代码:-
- (IBAction)checkInput
{
NSMutableString *aString = [NSMutableString stringWithFormat:firstDigit.text];
[aString appendFormat:secondDigit.text];
[aString appendFormat:thirdDigit.text];
[aString appendFormat:fourthDigit.text];
if([aString isEqualToString:@"1111"])
{
result.text = @"Right Password";
//UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryBoard" bundle:nil];
//UITableViewController *tvc = [self.storyboard instantiateViewControllerWithIdentifier:@"mainTableViewController"];
//[self.navigationController pushViewController:tvc animated:YES];
//[self removeFromParentViewController];
[self performSegueWithIdentifier:@"mainSegue" sender:self];
}
else {
result.text = @"Wrong Password";
}
NSLog(@"%@", aString);
}
checkInput 会在用户输入最后一位数字后立即被调用。我在我的第四个 TextField 的 Editing did End 上调用它。
任何帮助将不胜感激。 谢谢
【问题讨论】:
标签: iphone ios uinavigationcontroller uistoryboardsegue