// // UITableView+HLTEnumarateCells.h // // Created by Maciej Banasiewicz. // #import "UITableView+EnumarateCells.h" @implementation UITableView (EnumarateCells) - (void)enumarateTableViewCellsUsingBlock:(tableviewEnumerateHandler)handler { for (int i = 0; i < self.numberOfSections; i++) { for (int j = 0; j < [self numberOfRowsInSection:i]; j++) { NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:j inSection:i]; handler([self cellForRowAtIndexPath:newIndexPath]); } } } - (void)enumarateTableViewCellsSection:(NSInteger)section UsingBlock:(tableviewEnumerateHandler)handler { for (int j = 0; j < [self numberOfRowsInSection:section]; j++) { NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:j inSection:section]; handler([self cellForRowAtIndexPath:newIndexPath]); } } @end