Skip to content
Snippets Groups Projects
Commit 05772ac1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

sort models by name

parent d33e6a9c
No related branches found
No related tags found
No related merge requests found
...@@ -18,4 +18,6 @@ ...@@ -18,4 +18,6 @@
-(UIImage *) getPreview; -(UIImage *) getPreview;
-(void) setPreview:(NSString *)path; -(void) setPreview:(NSString *)path;
-(void) setUrl:(NSString *)url; -(void) setUrl:(NSString *)url;
-(NSComparisonResult)compare:(Model *)p;
@end @end
...@@ -73,4 +73,9 @@ ...@@ -73,4 +73,9 @@
_url = [NSURL URLWithString:url]; _url = [NSURL URLWithString:url];
} }
-(NSComparisonResult) compare:(Model *)p
{
return [[self getName] compare:[p getName]];
}
@end @end
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
} }
} }
} }
[models sortUsingSelector:@selector(compare:)];
UIBarButtonItem *about = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleBordered target:self action:@selector(showAbout)]; UIBarButtonItem *about = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleBordered target:self action:@selector(showAbout)];
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: about, nil]]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: about, nil]];
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
i--; i--;
} }
} }
[models sortUsingSelector:@selector(compare:)];
[self.tableView reloadData]; [self.tableView reloadData];
[self.refreshControl endRefreshing]; [self.refreshControl endRefreshing];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment