A custom submit button with normal, loading, success and warning state.
This is original inspired from a work on Pinterest, written in Swift with full implementation of animations.
Install Cocoapods if need be
$ gem install cocoapodsAdd NVActivityIndicatorView in your Podfile
use_frameworks!
pod 'DRSubmitButton'Then, run the following command
$ pod installCopy DRSubmitButton.swift to your project. That's it.
Firstly, import DRSubmitButton
import DRSubmitButtonInitialize your button with simple line of init method:
submitButton.init(frame: CGRectMake(0, 0, 160, 60))Implement your button with the usual addTarget method:
submitButtonDemo.addTarget(self, action: #selector(ViewController.demoFunction))The action will be triggered only during the .normal state. You can simply change the button state to loading state by:
submitButtonDemo.buttonState = .loadingsuccess state by:
submitButtonDemo.buttonState = .successThe icon images are fully customizable including:
- Submit Icon
- Success Icon
- Warning Icon
submitButtonDemo.submitImage = UIImage(named: "icon_submit");The color themes are fully customizable including:
- All Icon's Color
- All Background Color
submitButtonDemo.submitIconColor = UIColor(red: 6/255, green: 164/255, blue: 191/255, alpha: 1.0)
submitButtonDemo.normalBackgrounColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)The MIT License (MIT)
Copyright (c) 2016 Samuel Kao
