iphone - 如何使方法更改 Root View

标签 iphone objective-c ios xcode

我的应用程序结构如下:

- 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/

相关文章:

iphone - 用户是否可以使用iPhone sdk通过LinkedIn通过好友邀请 friend ?

ios - 通过presentViewController 在 View 之间移动。出了什么问题吗?

javascript - 尝试获取 HTML 内容时被阻止

ios - 如何在 PST Collectionview 中突出显示选定的单元格?

ios - Appstore发布应用的神奇记录,核心数据迁移

iPhone 事件套件 : programmatically create a EKCalendar?

iphone - 理解 objective-c 中的方法

iphone - 如何在url中使用变量

objective-c - objective-c 中的(覆盖)是什么

ios - 我如何替换 #define 以用于常见的 swift 和 objective-c 使用