UITableView+LookinServer.m 596 B

12345678910111213141516171819202122232425
  1. //
  2. // UITableView+LookinServer.m
  3. // LookinServer
  4. //
  5. // Created by Li Kai on 2019/9/5.
  6. // https://lookin.work
  7. //
  8. #import "UITableView+LookinServer.h"
  9. #import "LookinServerDefines.h"
  10. @implementation UITableView (LookinServer)
  11. - (NSArray<NSNumber *> *)lks_numberOfRows {
  12. NSUInteger sectionsCount = MIN(self.numberOfSections, 10);
  13. NSArray<NSNumber *> *rowsCount = [NSArray lookin_arrayWithCount:sectionsCount block:^id(NSUInteger idx) {
  14. return @([self numberOfRowsInSection:idx]);
  15. }];
  16. if (rowsCount.count == 0) {
  17. return nil;
  18. }
  19. return rowsCount;
  20. }
  21. @end