Skip to content

Commit

Permalink
Merge pull request #140 from nohana/feature/add_done_bar_button_Item_…
Browse files Browse the repository at this point in the history
…color

Added DoneBarButtonItem color.
  • Loading branch information
tyokujin authored Mar 17, 2022
2 parents 052ecd3 + 77602fc commit 6fb92c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions NohanaImagePicker/AssetListSelectableDateSectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class AssetListSelectableDateSectionController: UICollectionViewController, UICo
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setToolbarTitle(nohanaImagePickerController)
updateDoneBarButtonColor()
collectionView?.reloadData()
}

Expand All @@ -73,6 +74,13 @@ class AssetListSelectableDateSectionController: UICollectionViewController, UICo
}
}

private func updateDoneBarButtonColor() {
parent?.navigationItem.rightBarButtonItem?.setTitleTextAttributes([
.foregroundColor: nohanaImagePickerController.config.color.navigationBarDoneBarButtonItem,
.font: UIFont.systemFont(ofSize: 17, weight: .semibold)
], for: .normal)
}

// MARK: - UICollectionViewDataSource

override func numberOfSections(in collectionView: UICollectionView) -> Int {
Expand Down Expand Up @@ -242,6 +250,7 @@ class AssetListSelectableDateSectionController: UICollectionViewController, UICo
extension AssetListSelectableDateSectionController: AssetDateSectionHeaderViewDelegate {
func didPushPickButton() {
collectionView.reloadItems(at: collectionView.indexPathsForVisibleItems)
updateDoneBarButtonColor()
}
}

Expand All @@ -263,5 +272,6 @@ extension AssetListSelectableDateSectionController: AssetCellDelegate {
}
}
}
updateDoneBarButtonColor()
}
}
1 change: 1 addition & 0 deletions NohanaImagePicker/NohanaImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ extension NohanaImagePickerController {
public var separator: UIColor?
public var navigationBarBackground: UIColor = .white
public var navigationBarForeground: UIColor = .black
public var navigationBarDoneBarButtonItem: UIColor = .black
}
public var color = Color()

Expand Down
2 changes: 1 addition & 1 deletion NohanaImagePicker/RootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RootViewController: UIViewController {
// FIXME: The settings of UIBarButtonItemAppearance may not be reflected.
// Probably, this problem occurs when the settings are set to reflect the entire application.
navigationItem.rightBarButtonItem?.setTitleTextAttributes([
.foregroundColor: nohanaImagePickerController.config.color.navigationBarForeground,
.foregroundColor: nohanaImagePickerController.config.color.navigationBarDoneBarButtonItem,
.font: UIFont.systemFont(ofSize: 17, weight: .semibold)
], for: .normal)
}
Expand Down

0 comments on commit 6fb92c2

Please sign in to comment.