Skip to content

Commit

Permalink
Letter spacing fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
pmusolino committed Oct 16, 2017
1 parent b95cfc9 commit 77ce9ca
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Configs/PMSuperButton.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion PMSuperButton.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "PMSuperButton"
s.version = "2.0.2"
s.version = "2.0.3"
s.summary = "PMSuperButton is a powerful UIButton coming from the countryside, but with super powers!"
s.description = <<-DESC
A easy way to create custom and complex buttons with custom attributes, directly added to the iOS Interface Builder, very easy to integrate in every project!
Expand Down
2 changes: 1 addition & 1 deletion PMSuperButtonSample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ PMSuperButton is a powerful UIButton coming from the countryside, but with super
- [x] Change border color, width
- [x] Customize the corner radius
- [x] Set a gradient background
- [x] Letter spacing
- [x] Edit everything about the shadows: color, opacity, offset
- [x] Animations when the button is highlighted 🤗
- [x] Animations when the button is selected
Expand Down
21 changes: 1 addition & 20 deletions Sources/PMSuperButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ open class PMSuperButton: UIButton {
setupGradient()
}
}
@IBInspectable open var letterSpacing: CGFloat = 0 {
didSet {
let attributes = getAttributedString()
attributes.addAttribute(NSAttributedStringKey.kern, value: letterSpacing, range: NSRange(location: 0, length: attributes.length))
self.setAttributedTitle(attributes, for: .normal)
}
}

//MARK: - Gradient Background
@IBInspectable open var gradientStartColor: UIColor = UIColor.clear{
Expand Down Expand Up @@ -237,19 +230,7 @@ open class PMSuperButton: UIButton {

override open func prepareForInterfaceBuilder() {
}

// MARK: Private methods

// Return button's label attributed string based on optional attributedText or text
private func getAttributedString() -> NSMutableAttributedString {
if let attr = self.titleLabel?.attributedText {
return NSMutableAttributedString(attributedString: attr)
}
if let text = self.titleLabel?.text {
return NSMutableAttributedString(string: text)
}
return NSMutableAttributedString()
}

}

extension PMSuperButton: CAAnimationDelegate{
Expand Down

0 comments on commit 77ce9ca

Please sign in to comment.