Skip to content

A custom submit button with normal, loading, success and warning state.

License

Notifications You must be signed in to change notification settings

citysite102/DRSubmitButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DRSubmitButton

A custom submit button with normal, loading, success and warning state.

CI Status Version License Platform

This is original inspired from a work on Pinterest, written in Swift with full implementation of animations.

Installation

Cocoapods

Install Cocoapods if need be

$ gem install cocoapods

Add NVActivityIndicatorView in your Podfile

use_frameworks!

pod 'DRSubmitButton'

Then, run the following command

$ pod install

Manual

Copy DRSubmitButton.swift to your project. That's it.

Usage

Firstly, import DRSubmitButton

import DRSubmitButton

Initialization

Initialize 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))

Button State

The action will be triggered only during the .normal state. You can simply change the button state to loading state by:

submitButtonDemo.buttonState = .loading

success state by:

submitButtonDemo.buttonState = .success

Customize

The icon images are fully customizable including:

  1. Submit Icon
  2. Success Icon
  3. Warning Icon
submitButtonDemo.submitImage = UIImage(named: "icon_submit");

The color themes are fully customizable including:

  1. All Icon's Color
  2. 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)

License

The MIT License (MIT)

Copyright (c) 2016 Samuel Kao

About

A custom submit button with normal, loading, success and warning state.

Resources

License

Stars

Watchers

Forks

Packages

No packages published