Guest User

Untitled

a guest
May 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  2.  
  3. static NSString *MyIdentifier = @"MyIdentifier";
  4.  
  5. CustomCells *cell = (CustomCells *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
  6.  
  7. if (cell == nil) {
  8.  
  9. CGRect startingRect = CGRectMake(0.0, 0.0, 320.0, 100);
  10. cell = [[[CustomCells alloc] initWithFrame:startingRect reuseIdentifier:MyIdentifier] autorelease];
  11. }
  12. ClassObj *appdelegate = (ClassObj *)[[UIApplication sharedApplication] delegate];
  13. ClassObj *itemAtIndex = (ClassObj *)[appdelegate.allClass objectAtIndex:indexPath.row];
  14. [cell setData:itemAtIndex];
  15. return cell;
  16. }
  17.  
  18.  
  19.  
  20. \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  21. - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
  22. if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
  23. // Initialization code
  24.  
  25. // we need a view to place our labels on.
  26. UIView *myContentView = self.contentView;
  27.  
  28. /*
  29. init the title label.
  30. set the text alignment to align on the left
  31. add the label to the subview
  32. release the memory
  33. */
  34. self.titleLabel = [self newLabelWithPrimaryColor:[UIColor blackColor] selectedColor:[UIColor whiteColor] fontSize:22.0 bold:YES];
  35. self.titleLabel.textAlignment = UITextAlignmentLeft; // default
  36. [myContentView addSubview:self.titleLabel];
  37. [self.titleLabel release];
  38.  
  39. /*
  40. init the url label. (you will see a difference in the font color and size here!
  41. set the text alignment to align on the left
  42. add the label to the subview
  43. release the memory
  44. */
  45. self.urlLabel = [self newLabelWithPrimaryColor:[UIColor blackColor] selectedColor:[UIColor lightGrayColor] fontSize:10.0 bold:NO];
  46. self.urlLabel.textAlignment = UITextAlignmentLeft; // default
  47. [myContentView addSubview:self.urlLabel];
  48. [self.urlLabel release];
  49. }
  50.  
  51. return self;
  52. }
Add Comment
Please, Sign In to add comment