fixup search bar styling

This commit is contained in:
Ryan Nystrom
2017-10-13 19:31:44 -04:00
parent 4adfad92c8
commit f1161663f9
5 changed files with 10 additions and 9 deletions

View File

@@ -226,8 +226,10 @@ TabNavRootViewControllerType {
}
if object === searchKey {
let searchBarHeight = 44 + 2*Styles.Sizes.rowSpacing
return SearchBarSectionController(placeholder: NSLocalizedString("Search notifications", comment: ""), delegate: self, height: searchBarHeight)
return SearchBarSectionController(
placeholder: Strings.search,
delegate: self
)
}
switch object {

View File

@@ -29,6 +29,7 @@ final class SearchBarCell: UICollectionViewCell, UISearchBarDelegate {
contentView.backgroundColor = .white
searchBar.searchBarStyle = .minimal
searchBar.delegate = self
searchBar.tintColor = Styles.Colors.Blue.medium.color
contentView.addSubview(searchBar)

View File

@@ -16,21 +16,18 @@ protocol SearchBarSectionControllerDelegate: class {
final class SearchBarSectionController: ListSectionController, SearchBarCellDelegate {
private weak var delegate: SearchBarSectionControllerDelegate? = nil
private let height: CGFloat
private let placeholder: String
init(placeholder: String, delegate: SearchBarSectionControllerDelegate?, height: CGFloat) {
init(placeholder: String, delegate: SearchBarSectionControllerDelegate) {
self.delegate = delegate
self.height = height
self.placeholder = placeholder
super.init()
}
override func sizeForItem(at index: Int) -> CGSize {
guard let context = collectionContext else { fatalError("Collection context must be set") }
// 28 is the default height of UISegmentedControl
let height = 28 + 2*Styles.Sizes.rowSpacing
return CGSize(width: context.containerSize.width, height: height)
// hardcoded size of UISearchBar on iOS 11
return CGSize(width: context.containerSize.width, height: 56)
}
override func cellForItem(at index: Int) -> UICollectionViewCell {

View File

@@ -27,5 +27,6 @@ enum Strings {
static let newIssue = NSLocalizedString("New Issue", comment: "")
static let bullet = "\u{2022}"
static let bulletHollow = "\u{25E6}"
static let search = NSLocalizedString("Search", comment: "")
}

View File

@@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2012</string>
<string>2016</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>