Welcome, Guest
Username Password: Remember me

Dynamic sections and load more button
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Dynamic sections and load more button

Dynamic sections and load more button 1 year, 3 months ago #1

Hi, I would like to try the following scenario:

I have various records saved with Core Data, each of them has a created_at attribute. It would be cool to group records by created at, and display each group in a different table section:

-- 1 day ago --
record 1
record 2
-- 2 days ago --
record 3
record 4

To accomplish this, I was thinking at creating dynamic table sections, but I'm unsure about how to accomplish this. Particularly, when I create a new record and it gets pushed on the table view, how would the able view know in which section to display it? (perhaps I should just redisplay the table).

Another thing that would be interesting is adding a button at the end of the table view for loading more content, much like the twitter app does. I guess I would need to use a footer view right? Again, just in case, if anyone has some example of doing this with Sensible Table view that would help.

Re: Dynamic sections and load more button 1 year, 2 months ago #2

Hi Oscar,

STV can automatically generate these sections for you if you use an SCArrayOfObjectsModel. For a detailed example of this, please check out the "Core Data App" sample application, under the "People" tab.


 
Another thing that would be interesting is adding a button at the end of the table view for loading more content, much like the twitter app does.
 


We were actually planning to start implementing this as an out-of-the-box feature as soon as STV 2.0 is released. I think we can have this ready in about a month from now. If you need to implement this earlier, then placing the button in the footerView is one of the good alternatives. You should then update the "items" array (assuming you're using an SCArrayOfObjectsSection/SCArrayOfStringsSection), then reload the table view.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Dynamic sections and load more button 1 year, 2 months ago #3

I have follow on question to Oscar's.. I am looking at the CD sample..Cool..

But I have 10 items in each view, and I'd like to split them into 2 sections, one with the first two items, one with the others.

The current class def looks like this:

SCClassDefinition *vDef = [SCClassDefinition definitionWithEntityName:@"VEntity" withManagedObjectContext:self.managedObjectContext
withPropertyNames:[NSArray arrayWithObjects:@"A", @"B", @"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", nil]];

Is there a way to do this?

Thanks

David

Re: Dynamic sections and load more button 1 year, 2 months ago #4

Hi David,

You can split the section as the detail view is appearing. For more details, please check out this post: www.sensiblecocoa.com/forum/general-disc...table-view.html#1783
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.82 seconds