Tableview with sections managed by fetched results controller

Posted by Matthes on Stack Overflow See other posts from Stack Overflow or by Matthes
Published on 2009-08-11T14:57:39Z Indexed on 2010/04/08 13:03 UTC
Read the original article Hit count: 220

Filed under:
|

Hi,

I'm quite new to CoreData and need help with one issue. I have tableview which simply lists cities stored in SQLite db. City is defined by "cityId" and "name" attributes.

Data are fetched using NSFetchedResultsController and everything works fine except that I can't figure out how to make FetchedResultsController to group cities by first letter of city names.

When I supply "name" for sectionNameKeyPath argument of initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName: method, it creates section for each city, which is obviously something I don't want. I can't figure out how to create an expression which would make it work in way I need.

thanks for any tips and/or advices on this

Matthes

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data