gpt4 book ai didi

ios - 找不到导航 Controller 来导航另一个 View Controller

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

我有一个包含 5 个 UIViewControllers 的自定义 UIPageViewController,现在我想从这 5 个 UIViewController 之一进行导航,但我可以不是因为在那些 UIViewControllers 中没有 UINavigationController。谁能建议我如何从这 5 个 UIViewControllers 中的一个导航到其他 UIViewController

最佳答案

你的代码 - [AppDelegate application:didFinishLaunchingWithOptions:]可能看起来像这样(当然在检查你的跳过条件之后):

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc1 = [storyboard instantiateViewControllerWithIdentifier:@"MyAuth"]; //if you assigned this ID is storyboard
UIViewController *vc2 = [storyboard instantiateViewControllerWithIdentifier:@"Login"]; //if you assigned this ID is storyboard
UIViewController *vc3 = [storyboard instantiateViewControllerWithIdentifier:@"Details"];
NSArray *controllers = @[vc1, vc2, vc3];
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
[navController setViewControllers:controllers];

如果您只将其粘贴到 - [AppDelegate application:didFinishLaunchingWithOptions:],您会发现它会立即生效。

关于ios - 找不到导航 Controller 来导航另一个 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31242492/

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