gpt4 book ai didi

ios - performSegueWithIdentifier 不产生带有标识符错误的 segue

转载 作者:技术小花猫 更新时间:2023-10-29 10:42:44 25 4
gpt4 key购买 nike

我很难让 performSegueWithIdentifier 工作。我不断得到

"Receiver (<UINavigationController: 0x1e59a9d0>) has no segue with
identifier 'identA'"

我所做的是:

  1. 步骤:创建单 View 应用程序并向 View Controller 添加标签 - “View controller A”。
  2. 步骤:拖放另一个 View Controller 并向新的 View Controller 添加标签 - “View controller B”。
  3. 步骤:选择 View Controller A 并执行 Editor->embed in->navigation controller
  4. 步骤:将 View controller A 连接到 View controller B,并使用带有标识符“identA”的 push segue 像这样: wiring the seque

  5. 步骤:在 View Controller A 的 ViewDidLoad 上添加了对 performSegueWithIdentifier 的调用。像这样:


- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController performSegueWithIdentifier:@"identA" sender:self];
// Do any additional setup after loading the view, typically from a nib.
}

我做错了什么???

最佳答案

您正在 self.navigationController 上调用 performSegueWithIdentifier:sender: 但您在 View controller A 上设置了 segue:

wired View controller A to View controller B with push segue with Identifier "identA"

尝试替换:

[self.navigationController performSegueWithIdentifier:@"identA" sender:self];

[self performSegueWithIdentifier:@"identA" sender:self];

关于ios - performSegueWithIdentifier 不产生带有标识符错误的 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19040941/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com