【问题标题】:Accessing the superview of the parentview controller访问父视图控制器的父视图
【发布时间】:2012-10-26 15:23:50
【问题描述】:

我有一个 Viewcontroller A,我添加了一个 Viewcontroller B 作为子视图。 B有很多childviewcontroller C,D,E。 C,D,E 是 3 个 UItableViewcontroller。这就是我正在尝试的,当按下 C、D 或 E 的 UitableViewcells 时,我想从 A 切换到另一个视图控制器 F。

第一个问题:这是最好的方法吗?

你能帮忙吗?

【问题讨论】:

  • 确保您使用了正确的 UIViewController 包含函数。

标签: ios xcode ios6 parentviewcontroller


【解决方案1】:

一种解决方案是使用NSNotificationCenter 并向其中包含A 和B 的UINavigationController 发送通知。

【讨论】:

  • 我不明白,基本上我正在尝试访问 parentviewcontroller 的 superview 对吗?能给个示例代码吗?
  • 基本上,您添加一个超级视图或包含 A 和 B 的 unnavigationcontroller 作为和 observer 为您从 E 中的事件(如 didselectrow atIndexPath)触发的 NSNotification。这清楚吗,你熟悉 NSNotificationCenter 吗?
  • 基本上,你添加一个包含 A 和 B 的 superview 或 unnavigationcontroller ... 似乎缺少一些东西
  • 我终于用了nsnotification,它很简单,而且很好用,谢谢
猜你喜欢
  • 2015-07-14
  • 1970-01-01
  • 1970-01-01
  • 2017-12-27
  • 1970-01-01
  • 1970-01-01
  • 2012-10-28
  • 1970-01-01
相关资源
最近更新 更多