Guest User

Untitled

a guest
Jan 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  2. {
  3. return 1;
  4. }
  5.  
  6. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  7. {
  8. return [[[InventoryStore sharedInventory] allInventories] count];
  9. }
  10.  
  11. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  12. {
  13. Inventory *p = [[[InventoryStore sharedInventory] allInventories]
  14. objectAtIndex:[indexPath section]];
  15.  
  16. StepperCell *cell = [tableView
  17. dequeueReusableCellWithIdentifier:@"StepperCell"];
  18.  
  19. [cell setController:self];
  20. [cell setTableView:tableView];
  21.  
  22. [[cell nameLabel] setText:[p inventoryName]];
  23. [[cell valueLabel] setText:
  24. [NSString stringWithFormat:@"$%d", [p value]]];
  25. [[cell quantityLabel] setText:
  26. [NSString stringWithFormat:@"%d", [p quantity]]];
  27. cell.stepper.value = [p quantity];
  28.  
  29. return cell;
  30. }
  31.  
  32. InventoryViewController *inventoryViewController = [[InventoryViewController alloc] initWithStyle:UITableViewStyleGrouped];
  33.  
  34. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  35. if (indexPath.row % 2) {
  36. /* Your cell rendering code goes here */
  37. }
  38. else {
  39. UITableViewCell * blankCell = ....;
  40. }
  41. }
  42.  
  43. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  44. {
  45. return (numberOfInventoryItems * 2) - 1;
  46. }
Add Comment
Please, Sign In to add comment