0

Here I have a problem with the pushController because I want to use da, s my subclass like this

class cellEmpty < cell

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

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

Here the error :

undefined local variable or method `navigationController'

but me, so I think it must be that I use it in a subclass. but how to use it

thank you in advance

user1774481
  • 193
  • 3
  • 12

1 Answers1

0

You're getting this error because the method is being called from within a UICell. You'll need to call this method from with your view controller to get access to the navigationController.

If you're using a UITableViewController take a look at this method:

tableView(tableView, didSelectRowAtIndexPath: indexPath)

From there you can determine what to do when someone taps on a cell.

willrax
  • 346
  • 2
  • 6