Guidebook Engineering Blog

Guidebook's Progress Button Open Sourced

The recent release of Guidebook 4.0 included a new version of our download progress button which was heavily inspired by the progress button employed in the iOS app store. We received a number of requests to demonstrate how we created the progress button, and we decided to take it even further: we open sourced it.

Guidebook's progress button

Usage is simple:

  • Create the button as a custom view in your xib, or create it programatically.
  • Make sure that you don’t have a constraint for it’s width (it shrinks)–you might need to set the Intrinsic Content Size to “Placeholder” in your xib to avoid errors.

A simple example might look like:

[self.downloadButton setInitialTitle:@"Download"];
[self.downloadButton setCompleteTitle:@"Open"];

// Add a target (like a regular button)
[self.downloadButton addTarget:self action:@selector(downloadButtonPressed:) forControlEvents:UIControlEventTouchUpInside];

-(void)downloadButtonPressed:(id)sender {
    // Update the button's state based on your downloading item's state
    if(!self.isDownloading && !self.isDownloaded) {
        [self.downloadButton startProgressing];
        [self downloadItem];
    } else if(self.isDownloaded) {
        [self openItem];
    } else {
        [self cancelDownloadingItem];
        [self.downloadButton setProgress:0 animated:YES withCompletion:^{
            [self.downloadButton reset];

-(void)downloadProgressed:(CGFloat)progress {
  // Update the download button's progress when you get a progress update from your item
  [self.downloadButton setProgress:progress animated:YES];

You can also adjust the tint color of the entire view (which colors the button stroke, text, and icon):

self.downloadButton.tintColor = [UIColor redColor];

Let us know if you use it within your app or if you have any questions on implementation.

View the project on Github.

Share on Twitter View on Github