Paste UITableViewController into another UIView

I have a UITableViewController that inserts custom UITableViewCells into a UITableView. Is there a way I can put this UITableController / View collector in different views? I have a UITableView behavior that acts the way I want, I just want to use this UITableView in different UIViews (like UIView with UILabel over UITableView and one with UILabel below UITableView).

I know that I can make a UIViewController with a built-in UITableView in it and make the UIViewController act as a UITableView delegate, but then I would use code reuse (the UITableViewController logic would be in multiple UIViewControllers). Or am I looking at this problem incorrectly?

I want to somehow reuse the functionality of my UITableView in different UIView.

thank

+3
source share
1 answer

Yes, you can just instantiate (or get the link) the UITableViewController inside the UIViewController and call something like this:

[self.view addSubview:tableViewController.tableView];
+11
source

All Articles