Guest User

Untitled

a guest
May 26th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3.     //NSLog(@"cellForRowAtIndexPath");
  4.    
  5.     NSString *uniqueIdentifier = @"TwittCell";
  6.    
  7.     TwittCell *cell = (TwittCell *) [twittsTableView dequeueReusableCellWithIdentifier:uniqueIdentifier];
  8.  
  9.     Twitt *twitt = [self.arrayTwitts objectAtIndex:[indexPath row]];
  10.    
  11.     if(!cell)
  12.     {
  13.         NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TwittCell" owner:nil options:nil];
  14.        
  15.         for(id currentObject in topLevelObjects)
  16.         {
  17.             if([currentObject isKindOfClass:[TwittCell class]])
  18.             {
  19.                 cell = (TwittCell *)currentObject;
  20.                 break;
  21.             }
  22.         }
  23.     }
  24.    
  25.     cell.userLabel.text = twitt.user;
  26.     cell.textLabel.text = twitt.text;
  27.    
  28.     NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:twitt.pictureUrl]];  
  29.     cell.imageView.image = [[UIImage alloc] initWithData:imageData];
  30.  
  31.        
  32.     return cell;
  33.    
  34.    
  35. }
Add Comment
Please, Sign In to add comment