Skip to content

Commit a80a514

Browse files
author
Michael Beattie
committed
[#67874900] began creating sort method
1 parent d2c44d0 commit a80a514

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

EasyReader/Application/Controllers/Home/CSHomeViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)sender {
160160
- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender {
161161
// If we are scrolling in the collectionView only
162162
if([sender isMemberOfClass:[CSFeedItemCollectionView class]]) {
163-
164163
// unload the webView if we have moved to a new feedItem
165164
if(currentFeedItem != self.collectionView_feedItems.currentFeedItem){
165+
currentFeedItem = self.collectionView_feedItems.currentFeedItem;
166166
[self.feedItemWebView loadHTMLString:@"<html><head></head><body></body></html>" baseURL:nil];
167167
}
168168
}

EasyReader/Application/Controllers/Home/FeedItemCollectionView/CSFeedItemCollectionViewDataSource.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ - (id)initWithFeedItems:(NSArray *)feedItems
3838
return self;
3939
}
4040

41+
- (void)sortFeedItems
42+
{
43+
NSMutableArray *sortableArray = [NSMutableArray arrayWithArray:[self.feedItems allObjects]];
44+
45+
NSSortDescriptor *sortDescriptor;
46+
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"updatedAt"
47+
ascending:NO];
48+
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
49+
NSArray *sortedArray;
50+
sortedArray = [sortableArray sortedArrayUsingDescriptors:sortDescriptors];
51+
}
52+
4153
/**
4254
* Determines the number of sections in the collection view (in this case it's always 1)
4355
*

0 commit comments

Comments
 (0)