Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 0.97 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  2.  
  3.         static NSString *Custom = @"CustomCell";
  4.        
  5.         rowEvent = [arrayEvents objectAtIndex:indexPath.row];
  6.  
  7.         CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:Custom];
  8.                    
  9.         if (cell == nil) {
  10.                
  11.                 UIViewController *c = [[[UIViewController alloc] initWithNibName:Custom bundle:nil] autorelease];
  12.                 cell = (CustomCell *)c.view;
  13.         }
  14.        
  15.         cell.label.text = rowEvent.title;
  16.         cell.labelDate.text = [NSString stringWithFormat:@"%@, %@", rowEvent.category, rowEvent.date];
  17.         cell.labelLocation.text = rowEvent.place;
  18.        
  19.         UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectZero  ];
  20.         UIImage* bgImage = [UIImage imageNamed:@"EventCellBackground.png"];
  21.        
  22.         backgroundView.backgroundColor = [[[UIColor alloc] initWithPatternImage: bgImage] autorelease];
  23.         cell.backgroundView = backgroundView;
  24.        
  25.        
  26.         [backgroundView release];
  27.        
  28.     return cell;
  29. }