我的应用程序结构如下:
- Window
- Navigation controller
- Table view
- Button (in one of the rows)
- Tab bar controller
- tab..
- tab..
- tab..
(标签栏 Controller 未添加为 subview ,因此无法看到)
如何让按钮能够操纵导航 Controller 和标签栏 Controller 对象?
最佳答案
那么您可以将它们作为您的 AppDelegate
中的属性,如下所示:
@property (nonatomic, retain) UINavigationController *navigationController;
@property (nonatomic, retain) UITabBarController *tabBarController;
而且在你的 TableView 中你可以像这样得到一个指向它们的指针:
UINavigationController *navigationController = [(YourAppDelegateClass *)[[UIApplication sharedApplication] delegate] navigationController];
UITabBarController *tabBarController = [(YourAppDelegateClass *)[[UIApplication sharedApplication] delegate] tabBarController];
之后你可以让你的按钮做任何你想做的事。让我知道这是否适合您。
关于iphone - 如何使方法更改 Root View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7016365/