Latest 0.1.1
Homepage https://github.com/trongcuong1710/DTLoadingButton
License MIT
Platforms ios 8.0, requires ARC
Dependencies SWActivityIndicatorView
Authors

Version
License
Platform

Demo gif

Summary

This is a custom button to show loading state with an activity indicator sit next to title label. When on loading state (startAnimating), userInteraction will be disable.

Usage

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

Requirements

iOS 8 or above

Installation

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

pod "DTLoadingButton"

How to use

Initialize via code

let button = DTLoadingButton(type: .Custom)
button.frame = CGRectMake(100, 100, 300, 40)

self.addSubview(button)

Start animating

button.startAnimating

Stop animating

button.stopAnimating

You can also use this with Interface Builder by dragging an UIButton to your view controller. Set class to DTLoadingButton.

Interface Builder

Note You must set button type to Custom to avoid flickering when start and stop animating.

Customization

self.disabledTextColor = UIColor.whiteColor()
self.enabledTextColor = UIColor.whiteColor()
self.disabledBackgroundColor = UIColor(red: 0, green: 131.0 / 255.0, blue: 191.0 / 255.0, alpha: 1.0)
self.enabledBackgroundColor = UIColor(red: 0, green: 152.0 / 255.0, blue: 215.0 / 255.0, alpha: 1.0) 
self.indicatorViewLineWidth = 2.0 
self.indicatorColor = UIColor.lightGrayColor() 
self.normalText = "" 
self.loadingText = "LOADING..."

License

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

Latest podspec

{
    "name": "DTLoadingButton",
    "version": "0.1.1",
    "summary": "Custom button to show activity indicator to represent loading state.",
    "homepage": "https://github.com/trongcuong1710/DTLoadingButton",
    "license": "MIT",
    "authors": {
        "Cuong Doan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/trongcuong1710/DTLoadingButton.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "DTLoadingButton": [
            "Pod/Assets/*.png"
        ]
    },
    "dependencies": {
        "SWActivityIndicatorView": []
    }
}

Pin It on Pinterest

Share This