From 6165decafd046f7e757b4366efe6a982f0b3b03e Mon Sep 17 00:00:00 2001 From: Tong Cui Date: Fri, 16 Mar 2018 12:02:49 +0800 Subject: [PATCH 1/2] adjust color --- SKPhotoBrowser/SKButtons.swift | 6 +++++- SKPhotoBrowser/SKPhotoBrowserOptions.swift | 8 ++++---- SKPhotoBrowser/SKToolbar.swift | 2 +- SKPhotoBrowser/SKZoomingScrollView.swift | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/SKPhotoBrowser/SKButtons.swift b/SKPhotoBrowser/SKButtons.swift index a50a5ad8..9c40b55a 100644 --- a/SKPhotoBrowser/SKButtons.swift +++ b/SKPhotoBrowser/SKButtons.swift @@ -32,8 +32,12 @@ class SKButton: UIButton { translatesAutoresizingMaskIntoConstraints = true autoresizingMask = [.flexibleBottomMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin] - let image = UIImage(named: "SKPhotoBrowser.bundle/images/\(imageName)", + var image = UIImage(named: "SKPhotoBrowser.bundle/images/\(imageName)", in: bundle, compatibleWith: nil) ?? UIImage() + // Fix + image = image.withRenderingMode(.alwaysTemplate) + tintColor = .black + // End setImage(image, for: UIControlState()) } diff --git a/SKPhotoBrowser/SKPhotoBrowserOptions.swift b/SKPhotoBrowser/SKPhotoBrowserOptions.swift index fabede95..360c47e0 100644 --- a/SKPhotoBrowser/SKPhotoBrowserOptions.swift +++ b/SKPhotoBrowser/SKPhotoBrowserOptions.swift @@ -27,8 +27,8 @@ public struct SKPhotoBrowserOptions { public static var enableZoomBlackArea: Bool = true public static var enableSingleTapDismiss: Bool = false - public static var backgroundColor: UIColor = .black - public static var indicatorColor: UIColor = .white + public static var backgroundColor: UIColor = .white + public static var indicatorColor: UIColor = .black public static var indicatorStyle: UIActivityIndicatorViewStyle = .whiteLarge /// By default close button is on left side and delete button is on right. @@ -51,7 +51,7 @@ public struct SKPhotoBrowserOptions { } public struct SKCaptionOptions { - public static var textColor: UIColor = .white + public static var textColor: UIColor = .black public static var textAlignment: NSTextAlignment = .center public static var numberOfLine: Int = 3 public static var lineBreakMode: NSLineBreakMode = .byTruncatingTail @@ -59,7 +59,7 @@ public struct SKCaptionOptions { } public struct SKToolbarOptions { - public static var textColor: UIColor = .white + public static var textColor: UIColor = .black public static var font: UIFont = .systemFont(ofSize: 17.0) public static var textShadowColor: UIColor = .black } diff --git a/SKPhotoBrowser/SKToolbar.swift b/SKPhotoBrowser/SKToolbar.swift index 6b474636..3f07a21f 100644 --- a/SKPhotoBrowser/SKToolbar.swift +++ b/SKPhotoBrowser/SKToolbar.swift @@ -43,7 +43,7 @@ private extension SKToolbar { func setupToolbar() { toolActionButton = UIBarButtonItem(barButtonSystemItem: .action, target: browser, action: #selector(SKPhotoBrowser.actionButtonPressed)) - toolActionButton.tintColor = UIColor.white + toolActionButton.tintColor = UIColor.black var items = [UIBarButtonItem]() items.append(UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)) diff --git a/SKPhotoBrowser/SKZoomingScrollView.swift b/SKPhotoBrowser/SKZoomingScrollView.swift index 53204bf6..59ea4d55 100644 --- a/SKPhotoBrowser/SKZoomingScrollView.swift +++ b/SKPhotoBrowser/SKZoomingScrollView.swift @@ -59,7 +59,7 @@ open class SKZoomingScrollView: UIScrollView { imageView = SKDetectingImageView(frame: frame) imageView.delegate = self imageView.contentMode = .bottom - imageView.backgroundColor = .clear + imageView.backgroundColor = .white addSubview(imageView) // indicator @@ -67,7 +67,7 @@ open class SKZoomingScrollView: UIScrollView { addSubview(indicatorView) // self - backgroundColor = .clear + backgroundColor = .white delegate = self showsHorizontalScrollIndicator = SKPhotoBrowserOptions.displayHorizontalScrollIndicator showsVerticalScrollIndicator = SKPhotoBrowserOptions.displayVerticalScrollIndicator From 26d3a8c150c6f974a2ee80ed4598a03ea934e77f Mon Sep 17 00:00:00 2001 From: Tong Cui Date: Fri, 16 Mar 2018 14:17:53 +0800 Subject: [PATCH 2/2] [*]update animator background color --- SKPhotoBrowser/SKAnimator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SKPhotoBrowser/SKAnimator.swift b/SKPhotoBrowser/SKAnimator.swift index d2c93cad..63a9c2f0 100644 --- a/SKPhotoBrowser/SKAnimator.swift +++ b/SKPhotoBrowser/SKAnimator.swift @@ -22,7 +22,7 @@ class SKAnimator: NSObject, SKPhotoBrowserAnimatorDelegate { guard let window = UIApplication.shared.preferredApplicationWindow else { fatalError() } let backgroundView = UIView(frame: window.frame) - backgroundView.backgroundColor = .black + backgroundView.backgroundColor = .white backgroundView.alpha = 0.0 return backgroundView }()