Dilip
Dilip

Reputation: 33

Same UITableView in different viewcontrollers?

I have an application that has multiple viewcontrollers and one common menu table.

Menu table is same in all viewcontrollers. Currently, If i want to add some more menu in my menu table then I have to change in all the view controllers.

Can we have a common table view which can be called in different viewcontrollers?

Thanks

Upvotes: 1

Views: 226

Answers (3)

Arun
Arun

Reputation: 163

As I understand ur question, just create a tableView in CommonView (a ref. name) and as per your need you can call that table view. By this way you have to not change many times in your code.

Upvotes: 0

Anusha Kottiyal
Anusha Kottiyal

Reputation: 3905

Make a subclass of UITableView and create your menu in that like :

@interface menuTable : UITableView

Then you can use the instance of that class in all viewControllers.

Upvotes: 2

folex
folex

Reputation: 5287

Yes, you can. When you add UIView to some other UIView, former will be removed from it's Superview and added to latter as subview. Remember to be careful with view's frame. e.g. convert it using convertRect:toView: selector

Upvotes: 0

Related Questions