diff --git a/THPinViewController/THPinView.h b/THPinViewController/THPinView.h index 0adaf07..7e11d90 100644 --- a/THPinViewController/THPinView.h +++ b/THPinViewController/THPinView.h @@ -27,9 +27,14 @@ @property (nonatomic, weak) id delegate; @property (nonatomic, copy) NSString *promptTitle; @property (nonatomic, strong) UIColor *promptColor; +@property (nonatomic, strong) UIFont *promptFont; +@property (nonatomic, strong) UIFont *bottomButtonFont; +@property (nonatomic, strong) UIColor *bottomButtonColor; @property (nonatomic, assign) BOOL hideLetters; @property (nonatomic, assign) BOOL disableCancel; - (instancetype)initWithDelegate:(id)delegate NS_DESIGNATED_INITIALIZER; +- (void)resetInput; + @end diff --git a/THPinViewController/THPinView.m b/THPinViewController/THPinView.m index cd813a7..4ad4ff0 100644 --- a/THPinViewController/THPinView.m +++ b/THPinViewController/THPinView.m @@ -166,6 +166,35 @@ - (void)setPromptColor:(UIColor *)promptColor self.promptLabel.textColor = promptColor; } +- (UIFont *)promptFont +{ + return self.promptLabel.font; +} + +- (void)setPromptFont:(UIFont *)promptFont +{ + self.promptLabel.font = promptFont; +} + +- (UIFont *)bottomButtonFont +{ + return [[self.bottomButton titleLabel] font]; +} + +- (void)setBottomButtonFont:(UIFont *)bottomButtonFont { + [[self.bottomButton titleLabel] setFont:bottomButtonFont]; +} + +- (UIColor *)bottomButtonColor +{ + return [self.bottomButton tintColor]; +} + +- (void)setBottomButtonColor:(UIColor *)bottomButtonColor +{ + [self.bottomButton setTitleColor:bottomButtonColor forState:UIControlStateNormal]; +} + - (BOOL)hideLetters { return self.numPadView.hideLetters; diff --git a/THPinViewController/THPinViewController.h b/THPinViewController/THPinViewController.h index 3402b8a..5dc8c2e 100644 --- a/THPinViewController/THPinViewController.h +++ b/THPinViewController/THPinViewController.h @@ -39,9 +39,14 @@ static const NSInteger THPinViewControllerContentViewTag = 14742; @property (nonatomic, assign) BOOL translucentBackground; @property (nonatomic, copy) NSString *promptTitle; @property (nonatomic, strong) UIColor *promptColor; +@property (nonatomic, strong) UIFont *promptFont; +@property (nonatomic, strong) UIFont *bottomButtonFont; +@property (nonatomic, strong) UIColor *bottomButtonColor; @property (nonatomic, assign) BOOL hideLetters; // hides the letters on the number buttons @property (nonatomic, assign) BOOL disableCancel; // hides the cancel button - (instancetype)initWithDelegate:(id)delegate NS_DESIGNATED_INITIALIZER; +- (void)resetPinView; + @end diff --git a/THPinViewController/THPinViewController.m b/THPinViewController/THPinViewController.m index 6005568..c8bc1a1 100644 --- a/THPinViewController/THPinViewController.m +++ b/THPinViewController/THPinViewController.m @@ -49,6 +49,9 @@ - (void)viewDidLoad self.pinView.backgroundColor = self.view.backgroundColor; self.pinView.promptTitle = self.promptTitle; self.pinView.promptColor = self.promptColor; + self.pinView.promptFont = self.promptFont; + self.pinView.bottomButtonFont = self.bottomButtonFont; + self.pinView.bottomButtonColor = self.bottomButtonColor; self.pinView.hideLetters = self.hideLetters; self.pinView.disableCancel = self.disableCancel; self.pinView.translatesAutoresizingMaskIntoConstraints = NO; @@ -75,6 +78,13 @@ - (void)viewDidLoad multiplier:1.0f constant:pinViewYOffset]]; } +#pragma mark - Public methods + +- (void)resetPinView +{ + [self.pinView resetInput]; +} + #pragma mark - Properties - (void)setBackgroundColor:(UIColor *)backgroundColor @@ -124,6 +134,33 @@ - (void)setPromptColor:(UIColor *)promptColor self.pinView.promptColor = self.promptColor; } +- (void)setPromptFont:(UIFont *)promptFont +{ + if ([self.promptFont isEqual:promptFont]) { + return; + } + _promptFont = promptFont; + self.pinView.promptFont = self.promptFont; +} + +- (void)setBottomButtonFont:(UIFont *)bottomButtonFont +{ + if ([self.bottomButtonFont isEqual:bottomButtonFont]) { + return; + } + _bottomButtonFont = bottomButtonFont; + self.pinView.bottomButtonFont = self.bottomButtonFont; +} + +- (void)setBottomButtonColor:(UIColor *)bottomButtonColor +{ + if ([self.bottomButtonColor isEqual:bottomButtonColor]) { + return; + } + _bottomButtonColor = bottomButtonColor; + self.pinView.bottomButtonColor = self.bottomButtonColor; +} + - (void)setHideLetters:(BOOL)hideLetters { if (self.hideLetters == hideLetters) { diff --git a/THPinViewControllerExample/THViewController.m b/THPinViewControllerExample/THViewController.m index 91c1bf6..7587dfe 100644 --- a/THPinViewControllerExample/THViewController.m +++ b/THPinViewControllerExample/THViewController.m @@ -96,11 +96,15 @@ - (void)setLocked:(BOOL)locked - (void)showPinViewAnimated:(BOOL)animated { + UIColor *darkBlueColor = [UIColor colorWithRed:0.012f green:0.071f blue:0.365f alpha:1.0f]; THPinViewController *pinViewController = [[THPinViewController alloc] initWithDelegate:self]; + pinViewController.view.tintColor = darkBlueColor; pinViewController.promptTitle = @"Enter PIN"; - UIColor *darkBlueColor = [UIColor colorWithRed:0.012f green:0.071f blue:0.365f alpha:1.0f]; pinViewController.promptColor = darkBlueColor; + pinViewController.promptFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:35.0]; + pinViewController.bottomButtonFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:14.0]; pinViewController.view.tintColor = darkBlueColor; + pinViewController.bottomButtonColor = darkBlueColor; // for a solid background color, use this: pinViewController.backgroundColor = [UIColor whiteColor];