Created
December 18, 2015 05:26
-
-
Save tlkahn/dba464882e26baf97242 to your computer and use it in GitHub Desktop.
uitableview data source
This file contains hidden or 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
#pragma mark UITableViewDataSource | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return [self.statuses count]; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"STTwitterTVCellIdentifier"]; | |
if(cell == nil) { | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"STTwitterTVCellIdentifier"]; | |
} | |
NSDictionary *status = [self.statuses objectAtIndex:indexPath.row]; | |
NSString *text = [status valueForKey:@"text"]; | |
NSString *screenName = [status valueForKeyPath:@"user.screen_name"]; | |
NSString *dateString = [status valueForKey:@"created_at"]; | |
cell.textLabel.text = text; | |
cell.detailTextLabel.text = [NSString stringWithFormat:@"@%@ | %@", screenName, dateString]; | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment