tags:

views:

18

answers:

1

The original version of my app contains a UITableViewController that is pushed onto the screen when it is called. In my updated version, I have replaced that view with a regular UIViewcontroller that contains a tableView so that I can have a few graphics above the tableView, and it looks a lot better.

However, I'm having a lot of trouble declaring a new dataSource/Delegate for the tableView, and I was wondering if there was an easy way to use the old tableViewController as a dataSource/Delegate for the new tableView.

A: 

Should be able to just add it to the view like so:

UTTableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 326) style:UITableViewStylePlain];
tableview.delegate = self;
tableview.dataSource = self;
[self.view addSubview:tableview];
[tableview release];

Everything else should just work... probably

edit: oh and make sure you implement the delegate calls in your header class:

@interface View: UIViewController <UITableViewDelegate, UITableViewDataSource>
Rudiger
Thanks a lot man, I don't know why I had such a hard time with that, but it works great now, i appreciate it.
Suicide