Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 435c394

Browse files
authored
Merge pull request #380 from wordpress-mobile/feature/custom-header-traits-change
Invalidate custom header layout if trait collection changes
2 parents 3074b3f + 91bf947 commit 435c394

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Pod/Classes/WPMediaPickerViewController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,18 @@ - (void)viewDidDisappear:(BOOL)animated
294294
[self unregisterForKeyboardNotifications];
295295
}
296296

297+
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
298+
{
299+
[super traitCollectionDidChange:previousTraitCollection];
300+
301+
if ([self shouldShowCustomHeaderView]) {
302+
// If there's a custom header, we'll invalidate it so that it can adapt itself to dynamic type changes.
303+
UICollectionViewFlowLayoutInvalidationContext *context = [UICollectionViewFlowLayoutInvalidationContext new];
304+
[context invalidateSupplementaryElementsOfKind:UICollectionElementKindSectionHeader atIndexPaths:@[ [NSIndexPath indexPathForRow:0 inSection:0] ]];
305+
[self.collectionView.collectionViewLayout invalidateLayout];
306+
}
307+
}
308+
297309
- (UIViewController *)viewControllerToUseToPresent
298310
{
299311
// viewControllerToUseToPresent defaults to self but could be set to nil. Reset to self if needed.

WPMediaPicker.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WPMediaPicker'
5-
s.version = '1.8.2-beta.1'
5+
s.version = '1.8.2-beta.2'
66

77
s.summary = 'WPMediaPicker is an iOS controller that allows capture and picking of media assets.'
88
s.description = <<-DESC

0 commit comments

Comments
 (0)