FBTableDataSource.m 946 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "FBTableDataSource.h"
  10. @implementation FBTableDataSource
  11. - (NSUInteger)count
  12. {
  13. return 100;
  14. }
  15. - (NSString *)textForElementAtIndex:(NSInteger)index
  16. {
  17. return [NSString stringWithFormat:@"%ld", (long)index];
  18. }
  19. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  20. {
  21. return self.count;
  22. }
  23. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  24. {
  25. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
  26. cell.textLabel.text = [self textForElementAtIndex:indexPath.row];
  27. return cell;
  28. }
  29. @end