ios - 如何使用 Storyboard 在 UIPopover 中设置导航栏?

标签 ios uipopovercontroller uistoryboard

我想使用 Storyboard 在我的弹出窗口中添加一个导航栏。

当我尝试通过引用 Storyboard中弹出的导航 Controller (指我的弹出屏幕)的按钮来完成它时:

enter image description here

然后,我尝试将委托(delegate)分配给我的弹出 Controller :

  CheckBoxListingViewController *rdvc = [segue destinationViewController];
  rdvc.delegate = self;

但是当我尝试 NSLog 时,它总是在弹出 Controller 中返回 null。

我认为原因是因为我引用导航 Controller 而不是直接引用弹出 Controller ,因为当我直接引用它时,委托(delegate)不再为空。

我可以做什么来完成这些屏幕?有什么建议吗?非常感谢!

最佳答案

destinationController 指的是您的 UINavigationController 试试这个:

CheckBoxListingViewController *foo = (CheckBoxListingViewController *)((UINavigationController *)segue.destinationViewController).topViewController;

关于ios - 如何使用 Storyboard 在 UIPopover 中设置导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13347060/

相关文章:

ios - 具有多个单元附件按钮的表格 View 应一键打开和关闭弹出窗口

ios - UIPopoverController 的 View Controller 在键盘消失后调整大小

ios - 无法移动 UIImageView

ios - 导航左栏按钮项目作为图像 Logo

ios - 我如何实现 printInteractionControllerParentViewController : with a popover?

ios - Game Center 排行榜有时无法加载

ios - 在另一个 UIViewController init 中初始化自定义 UIViewController

ios - 如何让按钮在所有尺寸的单元格中都位于右侧?

ios - 自动布局工作错误

iphone - 如何根据 CGSize 更改缩放 CGPoint?