I have a VC that contains a containerview that holds a table view. = Root VC holds the tableview
I have setup a delegate from the tableview to the root VC that checks if the screen is being scrolled up or down, and this works.
What I now want to do is to have a delegate between root VC to the table view. When a button is clicked in the root VC I want to fire a function in the table view.
This will make the viewcontrollers have delegates implemented on each other - is that a problem?
eg:
class RootVC, tableViewDelegate
class Tableview, RootVCDelegate
My delegate looks like this:
protocol RootVCDelegate: class {
func RootVCDidTouchGrid(controller: RootViewController)
}
class rootvc { ...
weak var delegate: RootVCDelegate?
@IBAction func gridButtonDidTouch(sender: AnyObject) {
delegate?.RootVCDidTouchGrid(self)
}
Then in table view:
class tableview, RootVCDelegate {..
func RootVCDidTouchGrid(controller: RootViewController) {
println("touched!")
}
So why is never println("touched!")
fired?
Thanks