Skip to content

Display the progress of a task inline on the button that launches the action. Inspired by Apple.

License

Notifications You must be signed in to change notification settings

jnjosh/JNJProgressButton

Repository files navigation

JNJProgressButton

As part of the Objective-C Hackathon I thought I'd take a shot at building a button to display progress, much like the progress button in the new iOS 7 version of the App Store. This progress button is inspired as a blend of UIButton and UIProgressView with a few other things tossed in. Maybe it will be useful, maybe it will just be fun. You decide.

Progress in Action

TODO

  • Do better testing with AutoLayout.
  • Add support for better end state buttons.
  • Refactor out the stupid.
  • Properly handle -tintColor for the future.

Usage

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.progressButton.delegate = self;
    self.progressButton.tintColor = [UIColor blueColor];
    self.progressButton.startButtonImage = [UIImage imageNamed:@"download-image"];
    self.progressButton.endButtonImage = [UIImage imageNamed:@"action-image"];
}   

- (void)progressButtonStartButtonTapped:(JNJProgressButton *)button
{
    // Begin doing the download action or whatever asyncronous thing you need to do. Then start updating the progress progerty on the button.
}

- (void)progressButtonEndButtonTapped:(JNJProgressButton *)button
{
    // The button has reached the end of the progress and the user can now do whatever the action needed.
}

- (void)progressButtonDidCancelProgress:(JNJProgressButton *)button
{
    // The user has canceled the progress
}

Credits

Contact

License

JNJProgressButton is available under the MIT License, please see the LICENSE file for more information.

About

Display the progress of a task inline on the button that launches the action. Inspired by Apple.

Resources

License

Stars

Watchers

Forks

Packages

No packages published