Hey guys,
I have created a base UIViewController in my app which contains some shared functionality between other child controllers. The problem is that my base view controller implements the UITableViewDelegate and UITableViewDataSource, so if any of the child view controllers implements the same UITableViewDelegate and UITableViewDataSource raises an exception saying that I can't self as a subview of self.
I have tried different possible solutions and discover that the issue is actually the fact of having two table view. One is being inherited from the base controller and the other is in the child controller as soon as I remove the child controller table view everything works fine.
Also, I'm doing the layout in Storyboards. 😟
Any ideas?
Thanks!
So, at the end the issue was exactly as explained in the Exeception. I was trying to add the same view as a subview within my table view header view.
[view addSubview:view];It was a hard to find bug, but thanks to pair programming the issue was resolve. Just be careful with this type of bugs.
🙂