sorting sections does not seem to work anymore
the following code is am example
when this is run on the simulator sections sort CORRECTLY.. they sort from newest dates to oldest dates
BUT when run on a real device this does not work.. it will ONLY display sections from oldest > newest.. and no matter what sort setting or ascending setting that changes, it is always sorted oldest > newest
and i want it to sort like the sim, Newest > Oldest
SCArrayOfObjectsModel *model = [[SCArrayOfObjectsModel alloc] initWithTableView:self.tableView]; model.autoSortSections = YES; //model.dataFetchOptions.sort = TRUE; // enable sort model.dataFetchOptions.sortKey = @"timeStamp"; model.dataFetchOptions.sortAscending = NO; self.dateFormatter = [[NSDateFormatter alloc] init]; [self.dateFormatter setDateFormat:@"EEE d MMM yyyy"]; model.sectionActions.didFetchItemsFromStore = ^(SCArrayOfItemsSection *itemsSection, NSMutableArray *items) { // This is not the only way to sort, but probably the easiest when using STV SCDataFetchOptions *fetchOptions = [SCDataFetchOptions optionsWithSortKey:@"timeStamp" sortAscending:NO filterPredicate:nil]; [fetchOptions sortMutableArray:items]; }; model.modelActions.sectionHeaderTitleForItem = ^NSString*(SCArrayOfItemsModel *itemsModel, NSObject *item, NSUInteger itemIndex) { NSDate *myDate = [item valueForKey:@"timeStamp"]; FeedingListViewController *weakSelf = (FeedingListViewController*)[itemsModel viewController]; return [weakSelf.dateFormatter stringFromDate:myDate];; }; self.tableViewModel = model;
Oz
did some more testing and seem that its only the sim 6s Plus that and code changes change the sort order.. and other sim device or real device no matter the code setting sort old>new and never new>old
Edited by ozie, 29 March 2016 - 05:20 AM.