Latest 1.0.1
Homepage https://github.com/cruzdiego/DesignableButton
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Version
License
Platform

DesignableButton

Features

  • Designable on Storyboard
  • Touch Up Inside event can be directly linked to an IBAction. No need for subclassing, implementing UITapGestureRecognizer events or overriding touchesEnded method.
  • Flexible highlight behavior. Select which subviews you want to highlight at tap, no code needed.

Basic Usage

Drag an UIView to your Storyboard scene and change asign DesignableButton as its custom class

DesignableButton

From there, you can insert subviews to it and asign IBActions to its events (being Touch Up Inside the most used).

Customizing it

Thanks to IBInspectables, you can customize the following properties right on Storyboard:

DesignableButton

@IBInspectable var highlight:Bool = true

Determine if DesignableButton can be highlighted or not at tap. Default value is true.

@IBInspectable var highlightAlpha:CGFloat = 0.5

Alpha value applied to selected subviews (or entire DesignableButton if none is selected) on highlighted state. Default value is 0.5

@IBOutlet public var highlightableViews: [UIView]?

Collection of subviews selected to be highlighted at tap. If empty or nil (and highlight is true) entire DesignableButton is highlighted.

You can append subviews to this array either programatically or using Storyboard:

DesignableButton

Requirements

  1. iOS 8.2 or newer
  2. Xcode version supporting Swift 2.1 syntax (7.1 or later)

Installation

Using CocoaPods:

pod "DesignableButton"

Or manually:

  1. Copy DesignableButton.swift to your project’s bundle.

Author

Diego Cruz, [email protected]

License

DesignableButton is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DesignableButton",
    "version": "1.0.1",
    "summary": "Design it on Storyboard. A fully customizable button without the hassle.",
    "description": "Created with prototypers and designers in mind, DesignableButton lets you design a button with a full custom layout and elements inside of it. Don't worry about implementing UITapGestureRecognizers, overriding touchesEnded or another hack used for making a custom view tapable. nnIn adition, DesignableButton supports a customizable highlight behavior. Just tell it which subviews you want to highlight at tap.",
    "homepage": "https://github.com/cruzdiego/DesignableButton",
    "license": "MIT",
    "authors": {
        "Diego Cruz": "[email protected]"
    },
    "source": {
        "git": "https://github.com/cruzdiego/DesignableButton.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "DesignableButton": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This