How can I check if the UICollectionView header is currently in the rect view?

I need to know if there is currently an additional representation of the UICollectionView header to make it update / update when the application is modified / configured.

If the title is not displayed, after scrolling the title will be drawn accordingly, but right now, what happens only when loading, and if the user scrolls the title and vice versa.

If the title is in view, I need to update it, but I really don't want to reload the entire 0th section every time this parameter changes (only when the title is in view mode ...).

+4
source share
1 answer

You can do something like save the property when the view is deleted. Then change it when it disappears using:

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath; 

Depending on how you want your update to happen, you can either save bool isVisible or start NSTimer when it appears and stop the timer when it disappears.

Unfortunately, this is not like the visibleSupplementaryViews method.

+4
source

Source: https://habr.com/ru/post/1502497/


All Articles