objective-c - 在选项卡栏和导航栏内弹出 View 时遇到问题

标签 objective-c ios uinavigationcontroller uitabbarcontroller

我有一个 UITabBarController,它是 UINavigationBarController 中的第二项。 UITabBarController 中有几个 View ,其中一个是名为 AccountViewController 的 UIViewController 子类。明白了吗?

Login View Controller -> UIViewController + UITabBarController - > Account View Tab -> Button

我想使用按钮 - 注销 - 弹回到登录 View 。我该怎么做?

最佳答案

假设您正在其中一个 UIViewControllers 中创建 UITabBarController,这些 UIViewControllers 是您所在的 UINavigationController 中 View Controller 字符串的一部分做了类似的事情:

UITabBarController *mytabs = [[UITabBarController alloc] init];
[self.view addSubview:mytabs.view];
mytabs.delegate = self; // This is key to getting back your UINavigationController

您可以从添加到 mytabs.viewControllers 数组的 UIViewControllers 之一中调用此函数,如下所示:

[[(UIViewController *)self.tabBarController.delegate navigationController] popViewControllerAnimated:YES];

您还可以指定是否希望它转到 UINavigationController 堆栈中的特定 viewController 索引(以防万一您的登录 viewController 不是下一个或 Root View Controller )。

关于objective-c - 在选项卡栏和导航栏内弹出 View 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7636183/

相关文章:

ios/过滤表的最佳实践 - 一个或多个 View Controller

iOS为什么这个属性需要很强

iphone - Exc_Bad_Access 有时仅在显示警报 View 时

ios - iOS 中的方法是否需要前缀?

iPhone - 最终确定 Apple 的模糊 "VerificationController.m"

ios - 在 IOS 的 ImageView 中显示多个图像

iphone - 来自远程服务器的 obj-C、Json + Coredata - 没有本地数据库/数据库,最佳方法?

ios - 如何访问父 View Controller ?

objective-c - 应用程序打开时出现黑屏

iphone - 如何处理不在 UINavigationController 堆栈顶部的 UIViewController 的旋转?