Flexible Data source for Multi-Section Table View Controller
- by TuanCM
I have a TableViewController which display a list of NewsItem objects:
@interface NewsItem : NSObject {
NSString *feedID;
NSString *title;
NSDate *published;
}
I'm trying to implement a Table View Controller (multiple sections) that can display the list in two ways:
One divide News Items into sections which based on Published Date
The other would be based on FeedID (News source).
And I don't know how to structure the data source so that the code is easy to maintain.
I tried to put the list of News Items into a 2 dimension Array in this case is a NSMutableArray of NSArray objects. However I got some objc_exception_throw and I don't think this is flexible enough.
Could you guys give me some ideas?