From ab8358e80aee04b35af5bc39bcbe7d3a0c4cbc03 Mon Sep 17 00:00:00 2001 From: Anton Lisovoy Date: Thu, 1 Oct 2020 23:55:48 +0300 Subject: [PATCH] Add ability to change tint color of pagination buttons --- SKPhotoBrowser/SKPaginationView.swift | 3 ++- SKPhotoBrowser/SKPhotoBrowserOptions.swift | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SKPhotoBrowser/SKPaginationView.swift b/SKPhotoBrowser/SKPaginationView.swift index 8398ee85..9c4ee21e 100644 --- a/SKPhotoBrowser/SKPaginationView.swift +++ b/SKPhotoBrowser/SKPaginationView.swift @@ -134,6 +134,7 @@ class SKPaginationButton: UIButton { let insets: UIEdgeInsets = UIEdgeInsets(top: 13.25, left: 17.25, bottom: 13.25, right: 17.25) func setup(_ imageName: String) { + tintColor = SKPhotoBrowserOptions.paginationButtonsTintColor backgroundColor = .clear imageEdgeInsets = insets translatesAutoresizingMaskIntoConstraints = true @@ -145,7 +146,7 @@ class SKPaginationButton: UIButton { let image = UIImage(named: "SKPhotoBrowser.bundle/images/\(imageName)", in: bundle, compatibleWith: nil) ?? UIImage() - setImage(image, for: .normal) + setImage(image.withRenderingMode(.alwaysTemplate), for: .normal) } } diff --git a/SKPhotoBrowser/SKPhotoBrowserOptions.swift b/SKPhotoBrowser/SKPhotoBrowserOptions.swift index 77a2fd4e..b11fe59a 100644 --- a/SKPhotoBrowser/SKPhotoBrowserOptions.swift +++ b/SKPhotoBrowser/SKPhotoBrowserOptions.swift @@ -47,6 +47,8 @@ public struct SKPhotoBrowserOptions { /// Provide custom session configuration (eg. for headers, etc.) public static var sessionConfiguration: URLSessionConfiguration = .default + + public static var paginationButtonsTintColor: UIColor = .white } public struct SKButtonOptions {