I'm trying to implement a TableView from a different (Table)ViewController into a Scrollview. I'm literally trying for hours now and I can't figure out the problem. The error I get is:
-[UISectionRowData numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x687fdb0 2012-05-07 16:47:18.966 Test2[12212:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISectionRowData numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x687fdb0'
This is the code Segment I'm working with (Implemented in the viewDidLoad() method):
DateSubviewController *dateSubviewController = [[DateSubviewController alloc] init];
//This is the tableViewController which handles the code from the tableView I want to implement.
NSArray *views = [NSArray arrayWithObjects: [dateSubviewController view], nil];
self.scrollView.delegate = self;
self.pageControlBeingUsed = YES;
for (int i = 0; i < views.count; i++) {
CGRect frame;
frame.origin.x = self.scrollView.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
UITableView *subview = [views objectAtIndex:i];
[self.scrollView addSubview:subview];
subview = nil;
}
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * views.count, self.scrollView.frame.size.height);
The scrollview is working on it's own (Tested it with different colored frames).
The problem seems to be, that [dateSubviewController view] doesn't call the methods required for the tableView to Work. The view outlet is hooked up with the tableView but "greyed out" in the storyboards. I thought it might be pointing to a wrong view, so I already tried deleting the tableView and hook it up again. This had no effect. The crash appears right after the whole viewDidLoad() method is done.
When I try to use
NSArray *views = [NSArray arrayWithObjects: [dateSubviewController dateTable], nil];
(dateTable is the tableView I try to implement) to access the tableView directly the array views contains 0 elements in debugging. The TableView delegate methods aren't called either. But it doesn't crash.
I don't know what to do anymore. I'm working on this problem for about 6 hours now, debugged several times, did Internet research but didn't find anything. Thanks for your time!