user3231429
user3231429

Reputation: 205

How to reuse UITableView from another class

in my apps i want to to show a UITableView that exactly same with another UITableView from another class. Let say in my HomeClass.h i already have UITableView property:

@property (nonatomic, strong) IBOutlet UITableView *fromTable;

and already success implement this fromTable.

However, i also want to use this fromTable again from other class, lets say DetailClass. So when for example, i push a button in DetailClass, the button will show fromTable, also with all the delegates function like didSelect, etc.

Can i do that instead create other UITableView again in my DetailClass?

Thanks...

Upvotes: 0

Views: 106

Answers (1)

Jeff Holliday
Jeff Holliday

Reputation: 750

Refactor the UITableView's Delegate and DataSource methods into an object that you use in both Classes (presumably UIViewController subclasses).

Upvotes: 1

Related Questions