在切换视图控制器时,我在Xcode中出错

时间:2014-09-03 09:43:12

标签: ios uiviewcontroller breakpoints programmatically-created

我希望只有输入的密码正确才能进入视图控制器。 我使用了以下代码 -

 if(([input isEqual:@"12"]))
{
    NSLog(@"change view controller");
    NSString * storyboardName = @"Main";
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
    UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"secondViewController"];
    [self presentViewController:vc animated:YES completion:nil];

}

但是当我进入时,Xcode给了我一个sigbrt错误,所以我添加了一个所有异常断点,但它转到main.m并说'thread 1:break point 1.1'。

感谢您的阅读,如果您知道答案,请回答

1 个答案:

答案 0 :(得分:1)

SecondViewController *second=[self.storyboard instantiateViewControllerWithIdentifier:@"storyboardid"];
[self.navigationController presentViewController:second animated:YES completion:nil];