Take the 2-minute tour ×

I'm trying desperately to design my UI programmatically. But I think I'm in trouble to understand the concept. Basically I want a UI which contains different UIViews and a UITableView.

But now I'm stuck with the UITableView...

So my "main view" which should contain all these views is called AddListViewController(it inherence from UIViewController).

In the loadView method of this class I'm trying to add a table, but no chance. Has anyone a good example for me. I'm really dont see the point for a separate UITableView and UITableViewController.

Thx a lot

share|improve this question
You mean "create the UI", not "design the UI", surely.... –  skaffman Mar 9 '10 at 22:44

4 Answers 4

up vote 2 down vote accepted

You can create a new UITableView, very simply like this:

UITableView * tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStylePlain];
[tableView setDataSource:self];
[tableView setDelegate:self];
[self.view addSubview:tableView];
[tableView release];

EDIT: The above answer beat me to it.

share|improve this answer
Barely, but I left the data source and delegate out :) –  Tuomas Pelkonen Mar 9 '10 at 22:59

Just create your UITableView and add it as subview:

UITableView *table = 
  [[UITableView alloc] initWithFrame:CGRectMake(x, y, width, height)


[self.view addSubview: table];
[table release];
share|improve this answer

In loadView, you have to make every view - including the overall view associated with the view controller.

You perhaps want to do what you are trying to do in viewDidLoad instead?

share|improve this answer

i many be late in answering but still i am answering it use:

shareListView.delegate = self;
shareListView.dataSource = self;
share|improve this answer

Your Answer


