nsfetchedresultscontroller

Reflect changes to objects in a relationship in parent object with NSFetchedResultsController

旧街凉风 提交于 2020-01-01 04:18:09
问题 I have two entities event and time. The event entity has a 1 to many relationship to time entities as each event can be performed multiple times. Now I want to display all the events chronologically in a tableView. So I set up a fetchedResultsController to fetch all time objects, sort them according to the start time and display the event information by using the relationship to the event object. So far so good. But now if the user tabs an entry in the table I pass an event object to the

Sectioning TableView and rows with Core Data Swift

半腔热情 提交于 2020-01-01 03:50:10
问题 I have two tables in sqlite: The code was generated by XCode Generation: class Event: NSManagedObject { @NSManaged var startDate: NSDate @NSManaged var details: EventDetail //i think this property shoud be var details Array<EventDetail> am i correct? } class EventDetail: NSManagedObject { @NSManaged var title: String @NSManaged var location: String @NSManaged var note: String @NSManaged var endDate: NSDate @NSManaged var event: NSManagedObject } I want to put the events in section and the

NSFetchedResultsController returning objects with null indexPaths

跟風遠走 提交于 2020-01-01 00:48:10
问题 Details are in the comments. The following code: // Perform the fetch... NSError *error = nil; if (![[self fetchedResultsController] performFetch:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } // Confirm that objects were fetched by counting them... NSLog(@"Number of Objects = %i", [[fetchedResultsController fetchedObjects] count]); // Confirm that sections exist by counting them... NSLog(@"Numbers of Sections = %i", [[fetchedResultsController sections]

Add extra row to a UITableView managed by NSFetchedResultsController

送分小仙女□ 提交于 2019-12-29 08:32:47
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Add extra row to a UITableView managed by NSFetchedResultsController

孤者浪人 提交于 2019-12-29 08:32:20
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Add extra row to a UITableView managed by NSFetchedResultsController

为君一笑 提交于 2019-12-29 08:32:09
问题 I'm using a UITableViewController for a table in my app, and I've added an NSFetchedResultsController to provide the data to show in the table (setting self as it's delegate). However I would like to add a unique cell as the last cell of the table, unrelated to the items produced by the NSFetchedResultsController 's predicate, I want this cell to always be at the bottom of the table. I've tried simply added 1 to these methods in the table view data source: - (NSUInteger

Core Data: UITableView with multiple NSFetchedResultControllers

白昼怎懂夜的黑 提交于 2019-12-29 02:57:39
问题 What I want to do is pretty simple. In my UITableViewController, I want to load data from multiple NSFetchedResultControllers (I have multiple entities in my data model) and put data from each one into a different section in the table view. So for example, all the fetched items from the first NSFetchedResultController would go in section 0 in the UITableView, the fetched items from the other one goes into section 1, etc. The Core Data template project doesn't demonstrate how to do this.

NSFetchedResultsController: Multiple FRCs, Delegate Error when Updating

别等时光非礼了梦想. 提交于 2019-12-29 02:01:06
问题 Objective: Using FRC, sort Section's by startDate , an NSDate attribute, but want Today 's date Section to appear before Upcoming dates Section . I followed Apple's code using a transient property sectionIdentifier . Apple's sample code . and started with this project first: OneFRC I soon realized that this may not be possible with just one FRC (I could be wrong). Next, I decided to take a stab at this with 3 FRCs : ThreeFRC. TableView sections now appears in the Order that I want: Section 0:

A NSFetchedResultsController with date as sectionNameKeyPath

旧巷老猫 提交于 2019-12-28 01:55:15
问题 I develop an application which uses Core Data. In one UITableView, I want to display a list of my entities, sorted by the saved date of the objects. When I do this: fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"date" cacheName:nil]; I get for each object a new section because this code groups the dates according to the seconds, too. But I want a list of the objects, grouped by

NSFetchedResultsController v.s. UILocalizedIndexedCollation

假如想象 提交于 2019-12-27 17:08:04
问题 I am trying to use a FRC with mixed language data and want to have a section index. It seems like from the documentation you should be able to override the FRC's - (NSString *)sectionIndexTitleForSectionName:(NSString *)sectionName - (NSArray *)sectionIndexTitles and then use the UILocalizedIndexedCollation to have a localized index and sections. But sadly this does not work and is not what is intended to be used :( Has anyone been able to use a FRC with UILocalizedIndexedCollation or are we