Skip to content

Commit

Permalink
Merge pull request #140 from Babylonpartners/ilya/title-edge-insets
Browse files Browse the repository at this point in the history
Allow setting titleEdgeInsets on buttons
  • Loading branch information
mluisbrown authored Apr 4, 2019
2 parents 8ef7b9e + 2a6a9f5 commit b24b009
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions StyleSheets/StyleSheets/ButtonStyleSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open class ButtonStyleSheet: ViewStyleSheet<UIButton>, TextBoundComputing {
public var textFont: UIFont
public var contentHorizontalAlignment: UIControl.ContentHorizontalAlignment
public var contentEdgeInsets: UIEdgeInsets
public var titleEdgeInsets: UIEdgeInsets
public var imageEdgeInsets: UIEdgeInsets
public var textAlignment: TextAlignment = .center

Expand All @@ -24,6 +25,7 @@ open class ButtonStyleSheet: ViewStyleSheet<UIButton>, TextBoundComputing {
images: [State : UIImage?] = [:],
backgroundImages: [State : UIImage?] = [:],
contentEdgeInsets: UIEdgeInsets = .zero,
titleEdgeInsets: UIEdgeInsets = .zero,
imageEdgeInsets: UIEdgeInsets = .zero,
numberOfLines: Int = 1,
lineBreakMode: NSLineBreakMode = .byTruncatingMiddle
Expand All @@ -34,6 +36,7 @@ open class ButtonStyleSheet: ViewStyleSheet<UIButton>, TextBoundComputing {
self.images = images
self.backgroundImages = backgroundImages
self.contentEdgeInsets = contentEdgeInsets
self.titleEdgeInsets = titleEdgeInsets
self.imageEdgeInsets = imageEdgeInsets
self.numberOfLines = numberOfLines
self.lineBreakMode = lineBreakMode
Expand Down Expand Up @@ -64,6 +67,7 @@ open class ButtonStyleSheet: ViewStyleSheet<UIButton>, TextBoundComputing {
.forEach { button.setBackgroundImage($0.1, for: $0.0) }

button.contentEdgeInsets = contentEdgeInsets
button.titleEdgeInsets = titleEdgeInsets
button.imageEdgeInsets = imageEdgeInsets
}

Expand Down

0 comments on commit b24b009

Please sign in to comment.