Skip to content

Instantly share code, notes, and snippets.

@amannayak0007
Created February 5, 2015 18:13
Show Gist options
  • Save amannayak0007/e84d379d8e6096770395 to your computer and use it in GitHub Desktop.
Save amannayak0007/e84d379d8e6096770395 to your computer and use it in GitHub Desktop.
#import "MasterViewController.h"
#import "JSONModelLib.h"
#import "KivaFeed.h"
@interface MasterViewController () {
KivaFeed* _feed;
}
@end
@implementation MasterViewController
-(void)viewDidAppear:(BOOL)animated
{
//fetch the feed
_feed = [[KivaFeed alloc] initFromURLWithString:@"https://www.90degreeams.com/in/TodoList.ashx?user=1100"
completion:^(JSONModel *model, JSONModelError *err) {
//json fetched
NSLog(@"todos: %@", _feed.todos);
[self.tableView reloadData];
}];
}
#pragma mark - table methods
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _feed.todos.count;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
LoanModel* loan = _feed.todos[indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:@"%@",
loan.ToDoString];
return cell;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment