Fix media picker initial stick to bottom on iPad

This commit is contained in:
Ilya Laktyushin 2019-11-01 20:59:59 +04:00
parent 95b425e168
commit cd64a206b6

View File

@ -264,6 +264,10 @@
- (void)_adjustContentOffsetToBottom - (void)_adjustContentOffsetToBottom
{ {
if (!self.isViewLoaded) {
return;
}
UIEdgeInsets contentInset = [self controllerInsetForInterfaceOrientation:self.interfaceOrientation]; UIEdgeInsets contentInset = [self controllerInsetForInterfaceOrientation:self.interfaceOrientation];
bool hasOnScreenNavigation = false; bool hasOnScreenNavigation = false;
@ -308,6 +312,9 @@
_collectionViewWidth = frame.size.width; _collectionViewWidth = frame.size.width;
_collectionView.frame = frame; _collectionView.frame = frame;
[_collectionView.collectionViewLayout invalidateLayout];
[_collectionView layoutSubviews];
if (lastInverseOffset < 45) if (lastInverseOffset < 45)
{ {
[self _adjustContentOffsetToBottom]; [self _adjustContentOffsetToBottom];
@ -319,9 +326,6 @@
CGPoint contentOffset = CGPointMake(0, -contentInset.top); CGPoint contentOffset = CGPointMake(0, -contentInset.top);
[_collectionView setContentOffset:contentOffset animated:false]; [_collectionView setContentOffset:contentOffset animated:false];
} }
[_collectionView.collectionViewLayout invalidateLayout];
[_collectionView layoutSubviews];
} }
#pragma mark - Gallery #pragma mark - Gallery