Here’s the background: I’m initializing and setting the dataSource in my TTTableViewController like so:
- (void)createModel {
TTSectionedDataSource *dataSource = [[[TTSectionedDataSource alloc] init] autorelease];
dataSource.model = [[[LogsModel alloc] init] autorelease];
self.dataSource = dataSource;
}
The model is a TTURLRequestModel, so when the response is returned from the model, I set the dataSource’s items and sections in my TTTableViewController like so:
- (void)modelDidFinishLoad:(id<TTModel>)model {
((TTSectionedDataSource *)self.dataSource).items = ((LogsModel *)model).items;
((TTSectionedDataSource *)self.dataSource).sections = ((LogsModel *)model).sections;
[super modelDidFinishLoad:model];
}
This issue came up when I switched from using hard-coded data in my model to actually making a request to the web service. What am I doing wrong? Am I creating the model incorrectly? Or setting the items & sections on the dataSource in the wrong place? Any thoughts or comments are welcome and appreciated. Thanks!
Finally found the reason for this. In my model class (LogsModel for the code above), I implemented the
- (BOOL)isLoadedmethod when I was using hard-coded data. When I switched to making requests to the web service, my implementation ofisLoadedhappened to return NO all the time, so the TTTableViewController wasn’t showing my data. I removed my implementation of- (BOOL)isLoaded, and the problem was solved.