Skip to content

Instantly share code, notes, and snippets.

@gonzalezreal
Created November 3, 2012 12:16
Show Gist options
  • Select an option

  • Save gonzalezreal/4007223 to your computer and use it in GitHub Desktop.

Select an option

Save gonzalezreal/4007223 to your computer and use it in GitHub Desktop.
#import "TGRTweetCell.h"
.
.
.
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"Timeline", @"");
// Registramos nuestra celda en la tabla
[self.tableView registerClass:[TGRTweetCell class] forCellReuseIdentifier:kTweetCellIdentifier];
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self
action:@selector(loadNewTweets)
forControlEvents:UIControlEventValueChanged];
}
.
.
.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Obtenemos una celda
TGRTweetCell *cell = [tableView dequeueReusableCellWithIdentifier:kTweetCellIdentifier];
// Obtenemos el tweet correspondiente
TGRTweet *tweet = [self.fetchedResultsController objectAtIndexPath:indexPath];
// Configuramos la celda con el tweet
[cell configureWithTweet:tweet];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Obtenemos el tweet
TGRTweet *tweet = [self.fetchedResultsController objectAtIndexPath:indexPath];
// Obtenemos la altura necesaria para el tweet
return [TGRTweetCell heightForTweet:tweet];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment