Created
February 5, 2015 18:13
-
-
Save amannayak0007/e84d379d8e6096770395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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