MCActivityButton 0.2.1

MCActivityButton 0.2.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2015

Maintained by Marcos Curvello.




MCActivityButton is an objective-c UIButton subclass that animates a standard iOS activity indicator with a custom title when tapped.

This is currently a work in progress and has not been thoroughly tested. Use at your own risk.

Demo

Requirements

  • ARC

Installation

From CocoaPods:

Podfile

pod "MCActivityButton"

Usage

#import <MCActivityButton/MCActivityButton.h>

Create a MCActivityButton object and customize it.

MCActivityButton *button = [MCActivityButton alloc] initWithFrame:CGRectMake()];

Once you have your button object customize it like so:

// Default UIButton customization
button.titleLabel.textColor = [UIColor whiteColor];
button.titleLabel.font      = [UIFont fontWithName:@"HelveticaNeue" size:14];
button.backgroundColor      = [UIColor colorWithRed:0.000 green:0.294 blue:0.624 alpha:1.000];

// Initial and Action Button Title
button.initialTitle  = @"Login";
button.activityTitle = @"Logging in...";

// Locks Subsequent Button Clicks
button.buttonClickLock = YES;

// Button title animation duration
button.buttonAnimationDuration = 0.5;

// Optional Rounded Edges
button.layer.cornerRadius      = 5;
button.clipsToBounds           = YES;

// Customize Activity Indicator
button.activityIndicatorColor  = [UIColor whiteColor];
button.activityIndicatorMargin = 6;
button.activityIndicatorScale  = 0.8;

// Then Add Your Button to the view
[self.view addSubview:button];

// Force button to return to it's initial state
[button stopAnimating];

To Do

  • Fully implement view tests.
  • Dynamic frame calculations.
  • Different animation styles.
  • Different activity indicator styles.
  • Background and title color change.

Author

Marcos Curvello, [email protected]

License

MCActivityButton is available under the MIT License. See the LICENSE file for more info.