gpt4 book ai didi

ios - 根据标识符转至 View Controller?

转载 作者:行者123 更新时间:2023-11-29 10:52:11 27 4
gpt4 key购买 nike

我有几个具有相同类的 View Controller 。

当转到特定的时,我如何区分它们?

通常我会使用这段代码来完成它,但这只适用于只有一个类实例的情况:

SecondViewController *secondview = [[SecondViewController alloc] initWithNibName:nil bundle:nil];

[self presentViewController:secondview animated:YES completion:nil];

最佳答案

你有这些选择:

-使用 Storyboard等,使用segues;

-使用 Storyboard并使用:

ExploreViewController *ev = [self.storyboard instantiateViewControllerWithIdentifier:@"ProfileViewController"];

-不要使用 Storyboard,因此您只需根据要显示的 View Controller 在“initWithNibName”中设置 Nib 名称。

关于ios - 根据标识符转至 View Controller?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19991395/

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