Flexible Data source for Multi-Section Table View Controller

Posted by TuanCM on Stack Overflow See other posts from Stack Overflow or by TuanCM
Published on 2010-05-29T14:16:18Z Indexed on 2010/05/29 14:22 UTC
Read the original article Hit count: 229

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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c