From 8c6123f6db26c7a8a8b7ef2b41488cccb6a0c691 Mon Sep 17 00:00:00 2001 From: Lorenzo Greco Date: Fri, 22 Mar 2019 10:09:54 +0100 Subject: [PATCH 1/2] Fixed border outline issue --- LGButton/Classes/LGButton.swift | 23 ++++++++++++++--------- LGButton/Resources/LGButton.xib | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/LGButton/Classes/LGButton.swift b/LGButton/Classes/LGButton.swift index 3fcc27c..09cc0d6 100644 --- a/LGButton/Classes/LGButton.swift +++ b/LGButton/Classes/LGButton.swift @@ -18,7 +18,7 @@ open class LGButton: UIControl { } let touchDisableRadius : CGFloat = 100.0 - + private var availableFontIcons: [String: IconFont] = ["fa": Fonts.awesome, "io": Fonts.ion, "oc": Fonts.oct, @@ -26,9 +26,8 @@ open class LGButton: UIControl { "ma": Fonts.material, "ti": Fonts.themify, "mi": Fonts.map] - - var gradient : CAGradientLayer? + fileprivate var gradient : CAGradientLayer? fileprivate var rootView : UIView! @IBOutlet fileprivate weak var titleLbl: UILabel! @@ -56,6 +55,8 @@ open class LGButton: UIControl { @IBOutlet fileprivate var trailingLoadingConstraint: NSLayoutConstraint! @IBOutlet fileprivate var leadingLoadingConstraint: NSLayoutConstraint! + @IBOutlet weak var bgContentWidthConstraint: NSLayoutConstraint! + @IBOutlet weak var bgContentHeightConstraint: NSLayoutConstraint! public var isLoading = false { didSet { @@ -444,6 +445,8 @@ open class LGButton: UIControl { } fileprivate func setupBackgroundColor() { + bgContentWidthConstraint.constant = min(0, -borderWidth) + bgContentHeightConstraint.constant = min(0, -borderWidth) bgContentView.backgroundColor = bgColor } @@ -482,8 +485,8 @@ open class LGButton: UIControl { bgContentView.layer.cornerRadius = cornerRadius layer.cornerRadius = cornerRadius } - bgContentView.layer.borderColor = borderColor.cgColor - bgContentView.layer.borderWidth = borderWidth + self.layer.borderColor = borderColor.cgColor + self.layer.borderWidth = borderWidth } fileprivate func setupTitle() { @@ -547,10 +550,12 @@ open class LGButton: UIControl { } fileprivate func setupShadow(){ - layer.shadowOffset = shadowOffset - layer.shadowRadius = shadowRadius - layer.shadowOpacity = Float(shadowOpacity) - layer.shadowColor = shadowColor.cgColor + if shadowRadius > 0 { + layer.shadowOffset = shadowOffset + layer.shadowRadius = shadowRadius + layer.shadowOpacity = Float(shadowOpacity) + layer.shadowColor = shadowColor.cgColor + } } fileprivate func setupLoadingView(){ diff --git a/LGButton/Resources/LGButton.xib b/LGButton/Resources/LGButton.xib index 7a7f2fc..141c0b5 100644 --- a/LGButton/Resources/LGButton.xib +++ b/LGButton/Resources/LGButton.xib @@ -4,13 +4,16 @@ + + + From 7d3df5390422cfe465da17a08e72f05c3db58733 Mon Sep 17 00:00:00 2001 From: Lorenzo Greco Date: Fri, 22 Mar 2019 10:19:37 +0100 Subject: [PATCH 2/2] Version bump --- LGButton.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LGButton.podspec b/LGButton.podspec index 152be52..fb72c4a 100644 --- a/LGButton.podspec +++ b/LGButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'LGButton' - s.version = '1.1.5' + s.version = '1.1.6' s.summary = 'A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.' s.homepage = 'https://cocoapods.org/pods/LGButton' s.license = { :type => 'MIT', :file => 'LICENSE.md' }