Reputation: 2078
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.
Upvotes: 0
Views: 244
Reputation: 8348
i many be late in answering but still i am answering it use:
shareListView.delegate = self;
shareListView.dataSource = self;
Upvotes: 0
Reputation: 75058
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?
Upvotes: 1
Reputation: 10059
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.
Upvotes: 2
Reputation: 7821
Just create your UITableView and add it as subview:
UITableView *table =
[[UITableView alloc] initWithFrame:CGRectMake(x, y, width, height)
style:UITableViewStyleGrouped];
...
[self.view addSubview: table];
[table release];
Upvotes: 2