У меня есть UITableView с ячейками разной высоты, и мне нужно знать, когда они полностью видны или нет.
В настоящий момент я просматриваю каждую ячейку в списке видимых ячеек, чтобы проверить, полностью ли она виден всякий раз, когда прокручивается представление. Это лучший подход?
Здесь мой код:
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView {
    CGPoint offset = aScrollView.contentOffset;
    CGRect bounds = aScrollView.bounds;    
    NSArray* cells = myTableView.visibleCells;
    for (MyCustomUITableViewCell* cell in cells) {
        if (cell.frame.origin.y > offset.y &&
            cell.frame.origin.y + cell.frame.size.height < offset.y + bounds.size.height) {
            [cell notifyCompletelyVisible];
        }
        else {
            [cell notifyNotCompletelyVisible];
        }
    }
}
Edit:
Обратите внимание, что * - (NSArray) visibleCells возвращает видимые ячейки, которые полностью видимы и частично видимы.
Изменить 2:
Это переработанный код после объединения решений как lnafziger, так и Vadim Yelagin:
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView {
    NSArray* cells = myTableView.visibleCells;
    NSArray* indexPaths = myTableView.indexPathsForVisibleRows;
    NSUInteger cellCount = [cells count];
    if (cellCount == 0) return;
    // Check the visibility of the first cell
    [self checkVisibilityOfCell:[cells objectAtIndex:0] forIndexPath:[indexPaths objectAtIndex:0]];
    if (cellCount == 1) return;
    // Check the visibility of the last cell
    [self checkVisibilityOfCell:[cells lastObject] forIndexPath:[indexPaths lastObject]];
    if (cellCount == 2) return;
    // All of the rest of the cells are visible: Loop through the 2nd through n-1 cells
    for (NSUInteger i = 1; i < cellCount - 1; i++)
        [[cells objectAtIndex:i] notifyCellVisibleWithIsCompletelyVisible:YES];
}
- (void)checkVisibilityOfCell:(MultiQuestionTableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath {
    CGRect cellRect = [myTableView rectForRowAtIndexPath:indexPath];
    cellRect = [myTableView convertRect:cellRect toView:myTableView.superview];
    BOOL completelyVisible = CGRectContainsRect(myTableView.frame, cellRect);
    [cell notifyCellVisibleWithIsCompletelyVisible:completelyVisible];
}