MAConfirmButton is a subclass of UIButton that mirrors the behavior of system buy buttons on iOS.
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"
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];
+ (MAConfirmButton *)buttonWithTitle:(NSString *)disabledString confirm:(NSString *)confirmString;
+ (MAConfirmButton *)buttonWithDisabledTitle:(NSString *)disabledString;
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;
- (void)disableWithTitle:(NSString *)disabledString;
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.