mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-05 15:09:12 +08:00
fixup search bar styling
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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: "")
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2012</string>
|
||||
<string>2016</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
|
||||
Reference in New Issue
Block a user