Landscape layout in gif picker.

This commit is contained in:
Matthew Chen 2019-01-10 09:37:33 -05:00
parent 8577221b5b
commit bf0d92acfb
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -60,9 +60,7 @@ class GifPickerLayout: UICollectionViewLayout {
// We use 2 or 3 columns, depending on the device.
// 2 columns will show fewer GIFs at a time,
// but use less network & be a more responsive experience.
let screenSize = UIScreen.main.bounds.size
let screenWidth = min(screenSize.width, screenSize.height)
let columnCount = UInt(max(2, screenWidth / 130))
let columnCount = UInt(max(2, collectionView.width() / 130))
let totalViewWidth = UInt(collectionView.width())
let hTotalWhitespace = (2 * hInset) + (hSpacing * (columnCount - 1))

View File

@ -518,4 +518,10 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
}
tryToSearch()
}
public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
layout.invalidateLayout()
}
}

View File

@ -490,7 +490,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSLogInfo(@"showing root window.");
}
// By calling makeKeyAndVisible we ensure the rootViewController becomes firt responder.
// By calling makeKeyAndVisible we ensure the rootViewController becomes first responder.
// In the normal case, that means the SignalViewController will call `becomeFirstResponder`
// on the vc on top of its navigation stack.
[self.rootWindow makeKeyAndVisible];