Created
December 17, 2010 07:38
-
-
Save champierre/744625 to your computer and use it in GitHub Desktop.
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
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *CellIdentifier = @"SampleTable"; | |
if (!tweetMessages) { | |
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; | |
cell.textLabel.text = @"loading..."; | |
cell.textLabel.textColor = [UIColor grayColor]; | |
return cell; | |
} | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; | |
} | |
cell.textLabel.text = [tweetMessages objectAtIndex:[indexPath row]]; | |
cell.textLabel.adjustsFontSizeToFitWidth = YES; | |
cell.textLabel.numberOfLines = 3; | |
cell.textLabel.font = [UIFont boldSystemFontOfSize:12]; | |
cell.textLabel.textColor = [UIColor darkGrayColor]; | |
if (dispatch_queue_create != NULL) { | |
cell.imageView.image = [UIImage imageNamed:@"blank.png"]; | |
dispatch_async(image_queue, ^{ | |
UIImage *icon = [self getImage:[tweetIconURLs objectAtIndex:[indexPath row]]]; | |
dispatch_async(main_queue, ^{ | |
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | |
cell.imageView.image = icon; | |
}); | |
}); | |
} else { | |
cell.imageView.image = [self getImage:[tweetIconURLs objectAtIndex:[indexPath row]]]; | |
} | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment