Skip to content

Instantly share code, notes, and snippets.

@Adam0101
Created May 19, 2011 16:44
Show Gist options
  • Save Adam0101/981200 to your computer and use it in GitHub Desktop.
Save Adam0101/981200 to your computer and use it in GitHub Desktop.
FilltheCells
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [[self tweets]count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
NSDictionary *tweet = (NSDictionary *)[tweets objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@",[tweet objectForKey:@"text"]];
cell.detailTextLabel.text = [NSString stringWithFormat:@"User: %@",[tweet objectForKey:@"from_user"]];
NSLog(@"cell text %@",[tweet objectForKey:@"from_user"]);
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment