Latest 0.2
Homepage https://github.com/timbodeit/TextImageButton
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Build Status
Version
License
Platform

Image spacing and side selection for UIButton. Fully auto-layout compatible.

Example Gif

Usage

Setting text and image on TextImageButton works like it does on a vanilla UIButton:

let button = TextImageButton()

button.setTitle("I'm a TextImageButton", forState: .Normal)
button.setImage(UIImage(named: "beachball"), forState: .Normal)

TextImageButton


Spacing

It allows specifying the spacing between title and image:

button.spacing = 20

TextImageButton


Image position

To choose the side the image is set on, specify imagePosition.
There is also boolean @IBInspectable imageOnRight attribute that you can set inside the storyboard

button.imagePosition = .Right

TextImageButton

Swift Version

While TextImageButton can be used in Objective-C code, it is written completely in Swift.

Version 0.2 is compatible with Swift 3.
For Swift 2 use Version 0.1.1.

Example Project

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

TextImageButton is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "TextImageButton"

Author

Tim Bodeit, [email protected]

Inspired by this stackoverflow answer by jasongregori.

License

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

Latest podspec

{
    "name": "TextImageButton",
    "version": "0.2",
    "summary": "Image spacing and side selection for UIButton",
    "description": "TextImageButton allows specifying spacing between image and title as well as the sidento display the image on.",
    "homepage": "https://github.com/timbodeit/TextImageButton",
    "license": "MIT",
    "authors": {
        "Tim Bodeit": "[email protected]"
    },
    "source": {
        "git": "https://github.com/timbodeit/TextImageButton.git",
        "tag": "0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This