diff --git a/Example/TLPhotoPicker/ViewController.swift b/Example/TLPhotoPicker/ViewController.swift
index b6f7cd9d..11cad31e 100644
--- a/Example/TLPhotoPicker/ViewController.swift
+++ b/Example/TLPhotoPicker/ViewController.swift
@@ -18,6 +18,7 @@ class ViewController: UIViewController,TLPhotosPickerViewControllerDelegate {
@IBAction func pickerButtonTap() {
let viewController = CustomPhotoPickerViewController()
+ viewController.modalPresentationStyle = .fullScreen
viewController.delegate = self
viewController.didExceedMaximumNumberOfSelection = { [weak self] (picker) in
self?.showExceededMaximumAlert(vc: picker)
@@ -67,6 +68,7 @@ class ViewController: UIViewController,TLPhotosPickerViewControllerDelegate {
@IBAction func pickerWithCustomBlackStyle() {
let viewController = CustomBlackStylePickerViewController()
+ viewController.modalPresentationStyle = .fullScreen
viewController.delegate = self
viewController.didExceedMaximumNumberOfSelection = { [weak self] (picker) in
self?.showExceededMaximumAlert(vc: picker)
diff --git a/README.md b/README.md
index 5db57c91..e5987538 100644
--- a/README.md
+++ b/README.md
@@ -312,6 +312,8 @@ public struct TLPhotosPickerConfigure {
public var preventAutomaticLimitedAccessAlert = true // newest iOS 14
public var mediaType: PHAssetMediaType? = nil
public var numberOfColumn = 3
+ public var minimumLineSpacing: CGFloat = 5
+ public var minimumInteritemSpacing: CGFloat = 5
public var singleSelectedMode = false
public var maxSelectedAssets: Int? = nil //default: inf
public var fetchOption: PHFetchOptions? = nil //default: creationDate
diff --git a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
index 52cfbf29..72ccbcba 100644
--- a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
+++ b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
@@ -77,6 +77,8 @@ public struct TLPhotosPickerConfigure {
public var preventAutomaticLimitedAccessAlert = true
public var mediaType: PHAssetMediaType? = nil
public var numberOfColumn = 3
+ public var minimumLineSpacing: CGFloat = 5
+ public var minimumInteritemSpacing: CGFloat = 5
public var singleSelectedMode = false
public var maxSelectedAssets: Int? = nil
public var fetchOption: PHFetchOptions? = nil
@@ -235,16 +237,22 @@ open class TLPhotosPickerViewController: UIViewController {
registerForPreviewing(with: self, sourceView: collectionView)
}
-
+ updateUserInterfaceStyle()
+ }
+
+ private func updateUserInterfaceStyle() {
if #available(iOS 13.0, *) {
let userInterfaceStyle = self.traitCollection.userInterfaceStyle
let image = TLBundle.podBundleImage(named: "pop_arrow")
+ let subImage = TLBundle.podBundleImage(named: "arrow")
if userInterfaceStyle.rawValue == 2 {
self.popArrowImageView.image = image?.colorMask(color: .systemBackground)
+ self.subTitleArrowImageView.image = subImage?.colorMask(color: .white)
self.view.backgroundColor = .black
self.collectionView.backgroundColor = .black
- }else {
+ } else {
self.popArrowImageView.image = image?.colorMask(color: .white)
+ self.subTitleArrowImageView.image = subImage
self.view.backgroundColor = .white
self.collectionView.backgroundColor = .white
}
@@ -385,10 +393,11 @@ extension TLPhotosPickerViewController {
return
}
let count = CGFloat(self.configure.numberOfColumn)
- let width = floor((self.view.frame.size.width-(5*(count-1)))/count)
+ let width = floor((self.view.frame.size.width - (self.configure.minimumInteritemSpacing * (count-1))) / count)
self.thumbnailSize = CGSize(width: width, height: width)
layout.itemSize = self.thumbnailSize
layout.minimumInteritemSpacing = 0
+ layout.minimumLineSpacing = self.configure.minimumLineSpacing
self.collectionView.collectionViewLayout = layout
self.placeholderThumbnail = centerAtRect(image: self.configure.placeholderIcon, rect: CGRect(x: 0, y: 0, width: width, height: width))
self.cameraImage = centerAtRect(image: self.configure.cameraIcon, rect: CGRect(x: 0, y: 0, width: width, height: width), bgColor: self.configure.cameraBgColor)
@@ -408,9 +417,10 @@ extension TLPhotosPickerViewController {
self.titleLabel.text = self.configure.customLocalizedTitle["Camera Roll"]
self.subTitleLabel.text = self.configure.tapHereToChange
self.cancelButton.title = self.configure.cancelTitle
- self.cancelButton.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: UIFont.labelFontSize),NSAttributedString.Key.foregroundColor:UIColor.blue], for: .normal)
+
+ let attributes: [NSAttributedString.Key: Any] = [.font: UIFont.boldSystemFont(ofSize: UIFont.labelFontSize)]
+ self.doneButton.setTitleTextAttributes(attributes, for: .normal)
self.doneButton.title = self.configure.doneTitle
- self.doneButton.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: UIFont.labelFontSize),NSAttributedString.Key.foregroundColor:UIColor.blue], for: .normal)
self.emptyView.isHidden = true
self.emptyImageView.image = self.configure.emptyImage
self.emptyMessageLabel.text = self.configure.emptyMessage
@@ -425,11 +435,12 @@ extension TLPhotosPickerViewController {
self.usedPrefetch = false
}
if #available(iOS 9.0, *), self.allowedLivePhotos {
- }else {
+ } else {
self.allowedLivePhotos = false
}
self.customDataSouces?.registerSupplementView(collectionView: self.collectionView)
self.navigationBar.delegate = self
+ updateUserInterfaceStyle()
}
private func updatePresentLimitedLibraryButton() {
diff --git a/TLPhotoPicker/Classes/TLPhotosPickerViewController.xib b/TLPhotoPicker/Classes/TLPhotosPickerViewController.xib
index 0ca0037c..d98af0cb 100644
--- a/TLPhotoPicker/Classes/TLPhotosPickerViewController.xib
+++ b/TLPhotoPicker/Classes/TLPhotosPickerViewController.xib
@@ -75,7 +75,7 @@
-
+
@@ -172,7 +172,7 @@
-
+