【问题标题】:navigationController.pushViewController the method returns undefinednavigationController.pushViewController 方法返回 undefined
【发布时间】:2014-02-21 18:17:50
【问题描述】:

这里我的pushController有问题,因为我想使用da,s我的子类这样

class cellEmpty < cell

    @button_help.when(UIControlEventTouchUpInside) do
      push RecommendationController.alloc.init
    end

 def push(controller)
    navigationController.pushViewController(controller, animated:true)
  end
end

这里是错误:

undefined local variable or method `navigationController'

但是我,所以我想一定是我在子类中使用它。 但是怎么用呢

提前谢谢你

【问题讨论】:

    标签: ios rubymotion navigationcontroller


    【解决方案1】:

    您收到此错误是因为该方法是从 UICell 中调用的。您需要使用视图控制器调用此方法才能访问 navigationController。

    如果你使用的是 UITableViewController 看看这个方法:

    tableView(tableView, didSelectRowAtIndexPath: indexPath)
    

    从那里您可以确定当有人点击单元格时要做什么。

    【讨论】:

      猜你喜欢
      • 2020-12-21
      • 2019-05-30
      • 2021-07-02
      • 2013-11-17
      • 1970-01-01
      • 2021-11-04
      • 2016-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多