if ([scrollView isKindOfClass:[UITableView class]] ||
[scrollView isKindOfClass:[UICollectionView class]]) {
[scrollView aspect_hookSelector:@selector(reloadData) withOptions:AspectPositionAfter usingBlock:^(){
[weakScrollView insertSubview:headerConfig.backgroundView atIndex:0];
} error:nil];
}
Requirements: add backgroundView to the cell of collectionView,
To wait until collecitonView has executed reloadData, then execute
[collecitonView insertSubview:backgroundView atIndex:0];
Note: must be after reloadData