Objective C:PageViewController 的导航栏

Objective C: NavigationBar for PageViewController

我有一个 UITableViewController 被添加到一个 UIPageViewController 作为页面,程序推送 PageViewController 并在 [=13= 的顶部显示 UINavigationBar ],我想在UINavigationBar中添加UIBarButton来控制UITableViewCells,但只能在PageViewController的屏幕上进行,也就是说,与此按钮相关的所有事件都必须在 PageViewController 中处理,因为所有这些事件都与 TableView cell 控件相关,我希望它们在 UITableViewController.

中处理

我尝试了很多方法,比如在UITableViewController中定义一个IBOutlet,当viewDidLoad时,将self.NavigationItem rightitem设置为这个IBOutlet项,都成功了不工作。

我不知道您是如何创建 UINavigationController,但我假设您是从 PageViewController 开始创建的。如果是这种情况,请确保 PageViewController 推到 UINavigationControllerUITableViewController 上。您不能将 UITableViewController 添加到 PageViewController

换句话说,PageViewController 创建了一个带有 UINavigationController 的页面。然后你推到 UINavigationController UITableViewController.

那时在你的子类 UITableViewController 中,你应该可以访问 self.navigationItem,等等...