问题
I am trying to make a view that contains several tableViews in it - basically a week calendar view that each day is a tableView that shows the events of that day.
In the storyboard I'v added to the view a tableView and tried to connect it in two different ways in the viewDidLoad:
DaysTableViewController * tvc = [[DaysTableViewController alloc]  initWithStyle:UITableViewStylePlain];
self.dayView.delegate = tvc;
self.dayView.dataSource = tvc;
or:
DaysTableViewController * tvc = [[DaysTableViewController alloc] initWithStyle:UITableViewStylePlain];
self.dayView = tvc.tableView;
when dayView is my IBOutlet property for the tableView in the storyboard. but it crash in both ways, and I dont know where it crash in the code.
I know the DaysTableViewController itself works fine, because when I push it in a NavigationController it works.
Am I doing something wrong?
回答1:
You need to use TableViews inside a ViewController, not a TableViewController. A TVC can only have one tableview.
回答2:
I'v found the problem. it was a simple memory management problem, I mad the Object that was the dataBase in the ViewDidLoad and didn't have a strong property for it, and just got released... thanks everyone for the answers.
来源:https://stackoverflow.com/questions/9814278/several-tableviews-in-one-view