tommi
tommi

Reputation: 6973

How can I add a UITableView into a UIView?

I've a UIView - containerView.

I have a table view controller - aTableViewController.

I'm trying to add the table view into the table view controller using:

[containerView addSubview:aTableViewController.tableView];

But there isn't anything in the containerView. Hmm...

Upvotes: 1

Views: 362

Answers (2)

mrd3650
mrd3650

Reputation: 1391

Make sure that when you are initialising aTableViewController with – initWithFrame:style: the frame property is set correctly.

Upvotes: 1

James Webster
James Webster

Reputation: 32066

The code looks correct. Ensure that all of containerView, aTableViewController and the tableView are initialized properly. Try printing them out just before this line and ensure they are not nil

Upvotes: 1

Related Questions