gpt4 book ai didi

ios - 将ViewController添加到堆栈并在需要时弹出

转载 作者:行者123 更新时间:2023-12-01 20:05:20 24 4
gpt4 key购买 nike

我想在单击通知栏中的“通知”时导航到特定的 class ,然后在该特定的 class 中单击“后退”按钮,然后根据需要导航到上一个 class 。

谁能帮忙。

我已经添加了ViewController以这种方式堆叠

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];

SplashViewController *splashViewCon = (SplashViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"SplashId"];
AgreeViewController *agreeViewCon = (AgreeViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"agreeView"];
ViewController *loginViewCon = (ViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"loginView"];
LanguageViewController *languageViewCon = (LanguageViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"languageView"];
LandingScreenViewController *landingViewCon = (LandingScreenViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"landingScreenId"];
HomeScreenViewController *homeViewCon = (HomeScreenViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"homeScreen"];
OrderConfirmationViewController *orderconfirmViewCon = (OrderConfirmationViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"orderConfirmationVC"];
ThankYouViewController *thankViewCon = (ThankYouViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"ThankyouId"];
UploadQueueScreenViewController *uploadViewCon = (UploadQueueScreenViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"uploadQueue"];
NewOrderViewController *newOrderViewCon = (NewOrderViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"neworderView"];
MessageViewController *msgViewCon = (MessageViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"MessageInboxscreen"];
MessageDetailsViewController *msgdetailsViewCon = (MessageDetailsViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"msgDetailsView"];

NSArray *stack = [NSArray arrayWithObjects:splashViewCon,agreeViewCon,loginViewCon,languageViewCon,landingViewCon,homeViewCon,orderconfirmViewCon,thankViewCon,uploadViewCon,newOrderViewCon,msgViewCon,msgdetailsViewCon, nil];
navController.viewControllers = stack;

UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

if (notification)
{
MessageDetailsViewController *msgdetailsViewCon = (MessageDetailsViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"msgDetailsView"];
self.window.rootViewController = msgdetailsViewCon;
}
}

所以,我想弹出回到特定的viewController

最佳答案

据我所知,没有通用的类可用。尝试使用NSMutableArray,通过addObject添加,并通过objectAtIndex和removeObjectAtIndex获取第一个/最后一个。

您可能想要实现自己的代码以将其用作堆栈。
干杯:)

关于ios - 将ViewController添加到堆栈并在需要时弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39159813/

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