NT Segue 标识符未检测到 Segue



>我正在尝试使用 segue 切换视图(不是我第一次),正在识别 segue 活动,但没有发生任何操作

这是我的代码:

- (void)viewDidLoad
{
...
 [self performSegueWithIdentifier: @"thesegue" sender: self];
...
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    NSString *string=[segue identifier]; //checked if the string is actually equal "thesegue" unsing a breakpoint , and it s actually the case

    if ([[segue identifier] isEqualToString:@"thesegue"]) { 
        int x;
        x=2
    }
}

我已经在所有行上插入了断点,它只是跳到最后一个右括号(即它不识别 [segue 标识符] 等于"thegue")。

我错过了什么吗?

编辑:

我添加了 x=2,现在它进入了 if 语句,现在的问题是,知道它检测到 segue,为什么它不显示新视图?

尝试在

ViewDidAppear方法中执行Segue!

segue 标识符在情节提要/IB 中设置。 将其设置为该并正确建立连接,它将起作用。

最新更新