ave

AvePurchaseButton

iOS App Store Styled Purchase Button

Showing:

Popularity

Downloads/wk

0

GitHub Stars

134

Maintenance

Last Commit

5yrs ago

Contributors

3

Package

Dependencies

0

License

MIT

Categories

Readme

AvePurchaseButton

Drop In App Store Styled Purchase Button, with proper animations. Title configurable in Interface Builder.

Animations

A gif-movie showing how the button animates from normal to confirmation to in-progress state: Movie

Screenshot

A screenshot showing the different states of the button: Screenshot

How to use

Create an instance of AvePurchaseButton. Set the normalTitle, confirmationTitle and handle UIControlEventTouchUpInside. To change states, use -[AvePurchaseButton setButtonState:animated:].

Example usage:

- (void)addPurchaseButton {
  AvePurchaseButton* button = [[AvePurchaseButton alloc] initWithFrame:CGRectZero];
    [button addTarget:self action:@selector(purchaseButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
    button.buttonState = AvePurchaseButtonStateNormal;
    button.normalTitle = @"$ 2.99";
    button.confirmationTitle = @"BUY";
    [button sizeToFit];
    [self.view addSubview:button];
}

- (void)purchaseButtonTapped:(AvePurchaseButton*)button {
    switch(button.buttonState) {
        case AvePurchaseButtonStateNormal:
            [button setButtonState:AvePurchaseButtonStateConfirmation animated:YES];
            break;
            
        case AvePurchaseButtonStateConfirmation:
            // start the purchasing progress here, when done, go back to 
            // AvePurchaseButtonStateProgress
            [button setButtonState:AvePurchaseButtonStateProgress animated:YES];
            
            [self startPurchaseWithCompletionHandler:^{
               [button setButtonState:AvePurchaseButtonStateNormal animated:YES];
            }];
            break;
            
        case AvePurchaseButtonStateProgress:
            break;
    }
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100