InteractiveSideMenu
InteractiveSideMenu copied to clipboard
MenuViewController subclass of UITableViewController
As of now it is not possible to subclass from UITableViewController for the MenuViewController. For example I've written the following class:
class MyMenuViewController: UITableViewController {
// some logic
}
Now I would like to use this framework. The README states I just need to make MyMenuViewController
a subclass of MenuViewController
which doesn't work though as I need to subclass UITableViewController
and MenuViewController
is just a UIViewController
subclass.
Hi, @Dschee.
Yes, as you mentioned MenuViewController
is a UIViewController
subclass and, unfortunately, there is no an ability to use UITableViewController
at the moment.
A simple solution is just to use UITableView
in your MenuViewController
subclass and implement dataSource and delegate as well.
It would be interesting to know why do you prefer to use UITableViewController instead of putting UITableView
? Do you use static cells?
We're thinking about improving this point. Thanks for addressing it!
Please refer to this answer on SO if you want to learn the benefits of UITableViewController
– I will not explain why we use it. I know that I could do things with UIViewController
and a UITableView
but that's not the point. We will not change our code because this library isn't as flexible as it should be.
I think you should not make MenuViewController
a class and require apps to subclass from it. I don't have the time right now to implement a better solution as a pull request, but I know from other side bar libraries that I can assign anything that is a subclass of UIViewController
to some type from the library as the menu. If you really need this menu UIViewController
to have additional logic you could maybe use a protocol for that instead and make the menu controller confirm to that? Just an idea though, I'm sure there are plenty of different concepts to make this point more flexible.
@Dschee Thanks for your feedback.