MAConfirmButton
MAConfirmButton copied to clipboard
UIButton subclass for in-app buy buttons.
MAConfirmButton
MAConfirmButton is a subclass of UIButton that mirrors the behavior of system buy buttons on iOS.
Installation
CocoaPods is the recommended method of installing MAConfirmButton. Simply add the following line to your Podfile
and run pod install
.
pod 'MAConfirmButton', :git => 'https://github.com/gizmosachin/MAConfirmButton'
##Usage
#import "MAConfirmButton.h"
Example
MAConfirmButton *confirmButton = [MAConfirmButton buttonWithTitle:@"Button Title" confirm:@"Confirm Title"];
[confirmButton addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
[confirmButton setTintColor:[UIColor blueColor]];
[confirmButton setAnchor:CGPointMake(270, 25)];
[self.view addSubview:confirmButton];
Init
+ (MAConfirmButton *)buttonWithTitle:(NSString *)disabledString confirm:(NSString *)confirmString;
+ (MAConfirmButton *)buttonWithDisabledTitle:(NSString *)disabledString;
Anchor
It is important that the anchor be set in order to position this button in the view you are adding it to (height/width of the frame are calculated automatically). The anchor point is the top right and the button is always aligned right, just like iTunes / App Store buttons.
- (void)setAnchor:(CGPoint)anchor;
Change State
- (void)disableWithTitle:(NSString *)disabledString;
License
MAConfirmButton is available under the MIT license, see the LICENSE file for more information. MAConfirmButton was originally written by Mike Ahmarani, though this fork is maintained by Sachin Patel.