Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Source/FORMDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,10 @@ - (void)disable:(BOOL)disabled {
}
}

[UIView performWithoutAnimation:^{
[self.collectionView reloadItemsAtIndexPaths:[self.collectionView indexPathsForVisibleItems]];
[UIView animateWithDuration:0 animations:^{
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadItemsAtIndexPaths:[self.collectionView indexPathsForVisibleItems]];
} completion:nil];
}];

[[NSNotificationCenter defaultCenter] postNotificationName:FORMHideTooltips
Expand Down Expand Up @@ -720,6 +722,20 @@ - (NSArray *)sortTargets:(NSArray *)targets {
}

- (void)processTargets:(NSArray *)targets {
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
/*
Fixes: https://github.com/hyperoslo/Form/issues/559
This resolves the crash presented in issue #559. I think is likely because the layout is computing different states at the same time, first the scrolling, then the enabling and then processing the targets, adding some delay fixes the issue. Also, it seems like `UIView performWithoutAnimation` wasn't working as it should, so I had to update that as well.

This crash only occurs on iOS 10.
*/
[self performSelector:@selector(startProcessTargets:) withObject:targets afterDelay:0.01];
} else {
[self startProcessTargets:targets];
}
}

- (void)startProcessTargets:(NSArray *)targets {
[FORMTarget filteredTargets:targets
filtered:^(NSArray *shownTargets,
NSArray *hiddenTargets,
Expand Down