From b9141d77084931a8c22aad12e7a74387a4a96ab0 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 16 Feb 2015 21:03:10 -0500 Subject: [PATCH 1/7] Make so that promptFont is a public property on THPinViewController. --- THPinViewController/THPinView.h | 1 + THPinViewController/THPinView.m | 10 ++++++++++ THPinViewController/THPinViewController.h | 1 + THPinViewController/THPinViewController.m | 10 ++++++++++ 4 files changed, 22 insertions(+) diff --git a/THPinViewController/THPinView.h b/THPinViewController/THPinView.h index 0adaf07..d1ed2fa 100644 --- a/THPinViewController/THPinView.h +++ b/THPinViewController/THPinView.h @@ -27,6 +27,7 @@ @property (nonatomic, weak) id delegate; @property (nonatomic, copy) NSString *promptTitle; @property (nonatomic, strong) UIColor *promptColor; +@property (nonatomic, strong) UIFont *promptFont; @property (nonatomic, assign) BOOL hideLetters; @property (nonatomic, assign) BOOL disableCancel; diff --git a/THPinViewController/THPinView.m b/THPinViewController/THPinView.m index cd813a7..8edec8c 100644 --- a/THPinViewController/THPinView.m +++ b/THPinViewController/THPinView.m @@ -166,6 +166,16 @@ - (void)setPromptColor:(UIColor *)promptColor self.promptLabel.textColor = promptColor; } +- (UIFont *)promptFont +{ + return self.promptLabel.font; +} + +- (void)setPromptFont:(UIFont *)promptFont +{ + self.promptLabel.font = promptFont; +} + - (BOOL)hideLetters { return self.numPadView.hideLetters; diff --git a/THPinViewController/THPinViewController.h b/THPinViewController/THPinViewController.h index 3402b8a..361c8f2 100644 --- a/THPinViewController/THPinViewController.h +++ b/THPinViewController/THPinViewController.h @@ -39,6 +39,7 @@ 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, assign) BOOL hideLetters; // hides the letters on the number buttons @property (nonatomic, assign) BOOL disableCancel; // hides the cancel button diff --git a/THPinViewController/THPinViewController.m b/THPinViewController/THPinViewController.m index 6005568..6c83432 100644 --- a/THPinViewController/THPinViewController.m +++ b/THPinViewController/THPinViewController.m @@ -49,6 +49,7 @@ - (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.hideLetters = self.hideLetters; self.pinView.disableCancel = self.disableCancel; self.pinView.translatesAutoresizingMaskIntoConstraints = NO; @@ -124,6 +125,15 @@ - (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)setHideLetters:(BOOL)hideLetters { if (self.hideLetters == hideLetters) { From da9b0581241f8295a50ff886c0a48a4ffa54b01f Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 16 Feb 2015 21:03:37 -0500 Subject: [PATCH 2/7] Make prompt large and bold in example project. --- THPinViewControllerExample/THViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/THPinViewControllerExample/THViewController.m b/THPinViewControllerExample/THViewController.m index 91c1bf6..18d2c37 100644 --- a/THPinViewControllerExample/THViewController.m +++ b/THPinViewControllerExample/THViewController.m @@ -100,6 +100,7 @@ - (void)showPinViewAnimated:(BOOL)animated 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.view.tintColor = darkBlueColor; // for a solid background color, use this: From cdb3a62309b25cf3008f2a3c221e21391912c03a Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 16 Feb 2015 21:39:38 -0500 Subject: [PATCH 3/7] Make so that bottomButtonFont is a public property on THPinViewController. --- THPinViewController/THPinView.h | 1 + THPinViewController/THPinView.m | 9 +++++++++ THPinViewController/THPinViewController.h | 1 + THPinViewController/THPinViewController.m | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/THPinViewController/THPinView.h b/THPinViewController/THPinView.h index d1ed2fa..be5a0dd 100644 --- a/THPinViewController/THPinView.h +++ b/THPinViewController/THPinView.h @@ -28,6 +28,7 @@ @property (nonatomic, copy) NSString *promptTitle; @property (nonatomic, strong) UIColor *promptColor; @property (nonatomic, strong) UIFont *promptFont; +@property (nonatomic, strong) UIFont *bottomButtonFont; @property (nonatomic, assign) BOOL hideLetters; @property (nonatomic, assign) BOOL disableCancel; diff --git a/THPinViewController/THPinView.m b/THPinViewController/THPinView.m index 8edec8c..aa6ac5f 100644 --- a/THPinViewController/THPinView.m +++ b/THPinViewController/THPinView.m @@ -176,6 +176,15 @@ - (void)setPromptFont:(UIFont *)promptFont self.promptLabel.font = promptFont; } +- (UIFont *)bottomButtonFont +{ + return [[self.bottomButton titleLabel] font]; +} + +- (void)setBottomButtonFont:(UIFont *)bottomButtonFont { + [[self.bottomButton titleLabel] setFont:bottomButtonFont]; +} + - (BOOL)hideLetters { return self.numPadView.hideLetters; diff --git a/THPinViewController/THPinViewController.h b/THPinViewController/THPinViewController.h index 361c8f2..4c011ce 100644 --- a/THPinViewController/THPinViewController.h +++ b/THPinViewController/THPinViewController.h @@ -40,6 +40,7 @@ static const NSInteger THPinViewControllerContentViewTag = 14742; @property (nonatomic, copy) NSString *promptTitle; @property (nonatomic, strong) UIColor *promptColor; @property (nonatomic, strong) UIFont *promptFont; +@property (nonatomic, strong) UIFont *bottomButtonFont; @property (nonatomic, assign) BOOL hideLetters; // hides the letters on the number buttons @property (nonatomic, assign) BOOL disableCancel; // hides the cancel button diff --git a/THPinViewController/THPinViewController.m b/THPinViewController/THPinViewController.m index 6c83432..3045eab 100644 --- a/THPinViewController/THPinViewController.m +++ b/THPinViewController/THPinViewController.m @@ -50,6 +50,7 @@ - (void)viewDidLoad self.pinView.promptTitle = self.promptTitle; self.pinView.promptColor = self.promptColor; self.pinView.promptFont = self.promptFont; + self.pinView.bottomButtonFont = self.bottomButtonFont; self.pinView.hideLetters = self.hideLetters; self.pinView.disableCancel = self.disableCancel; self.pinView.translatesAutoresizingMaskIntoConstraints = NO; @@ -134,6 +135,15 @@ - (void)setPromptFont:(UIFont *)promptFont self.pinView.promptFont = self.promptFont; } +- (void)setBottomButtonFont:(UIFont *)bottomButtonFont +{ + if ([self.bottomButtonFont isEqual:bottomButtonFont]) { + return; + } + _bottomButtonFont = bottomButtonFont; + self.pinView.bottomButtonFont = self.bottomButtonFont; +} + - (void)setHideLetters:(BOOL)hideLetters { if (self.hideLetters == hideLetters) { From 2f302d1598f754ec057ec58b01e2b4ceb8f75915 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 16 Feb 2015 21:39:57 -0500 Subject: [PATCH 4/7] Make bottom button smaller and bold in example project. --- THPinViewControllerExample/THViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/THPinViewControllerExample/THViewController.m b/THPinViewControllerExample/THViewController.m index 18d2c37..b87a57d 100644 --- a/THPinViewControllerExample/THViewController.m +++ b/THPinViewControllerExample/THViewController.m @@ -101,6 +101,7 @@ - (void)showPinViewAnimated:(BOOL)animated 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; // for a solid background color, use this: From 44ef80b2702ae6c68bc153d16eee0cb8d6dd8d93 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 17 Feb 2015 10:06:13 -0500 Subject: [PATCH 5/7] Allow user to set the title color of the Bottom Button. --- THPinViewController/THPinView.h | 1 + THPinViewController/THPinView.m | 10 ++++++++++ THPinViewController/THPinViewController.h | 1 + THPinViewController/THPinViewController.m | 10 ++++++++++ 4 files changed, 22 insertions(+) diff --git a/THPinViewController/THPinView.h b/THPinViewController/THPinView.h index be5a0dd..57207f0 100644 --- a/THPinViewController/THPinView.h +++ b/THPinViewController/THPinView.h @@ -29,6 +29,7 @@ @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; diff --git a/THPinViewController/THPinView.m b/THPinViewController/THPinView.m index aa6ac5f..4ad4ff0 100644 --- a/THPinViewController/THPinView.m +++ b/THPinViewController/THPinView.m @@ -185,6 +185,16 @@ - (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 4c011ce..4c514b3 100644 --- a/THPinViewController/THPinViewController.h +++ b/THPinViewController/THPinViewController.h @@ -41,6 +41,7 @@ static const NSInteger THPinViewControllerContentViewTag = 14742; @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 diff --git a/THPinViewController/THPinViewController.m b/THPinViewController/THPinViewController.m index 3045eab..6ff581d 100644 --- a/THPinViewController/THPinViewController.m +++ b/THPinViewController/THPinViewController.m @@ -51,6 +51,7 @@ - (void)viewDidLoad 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; @@ -144,6 +145,15 @@ - (void)setBottomButtonFont:(UIFont *)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) { From 6356f5bfbbaac9cb991bff125c1f2bc0629958c4 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 17 Feb 2015 10:06:52 -0500 Subject: [PATCH 6/7] Use the new Bottom Button Text Color control to match the button text color with the view's tint color. --- THPinViewControllerExample/THViewController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/THPinViewControllerExample/THViewController.m b/THPinViewControllerExample/THViewController.m index b87a57d..7587dfe 100644 --- a/THPinViewControllerExample/THViewController.m +++ b/THPinViewControllerExample/THViewController.m @@ -96,13 +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]; From 969af02b8238c25c4c34f25a87a461c40e02dce9 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Wed, 20 May 2015 17:27:14 -0400 Subject: [PATCH 7/7] Allow client to reset the Pin View. --- THPinViewController/THPinView.h | 2 ++ THPinViewController/THPinViewController.h | 2 ++ THPinViewController/THPinViewController.m | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/THPinViewController/THPinView.h b/THPinViewController/THPinView.h index 57207f0..7e11d90 100644 --- a/THPinViewController/THPinView.h +++ b/THPinViewController/THPinView.h @@ -35,4 +35,6 @@ - (instancetype)initWithDelegate:(id)delegate NS_DESIGNATED_INITIALIZER; +- (void)resetInput; + @end diff --git a/THPinViewController/THPinViewController.h b/THPinViewController/THPinViewController.h index 4c514b3..5dc8c2e 100644 --- a/THPinViewController/THPinViewController.h +++ b/THPinViewController/THPinViewController.h @@ -47,4 +47,6 @@ static const NSInteger THPinViewControllerContentViewTag = 14742; - (instancetype)initWithDelegate:(id)delegate NS_DESIGNATED_INITIALIZER; +- (void)resetPinView; + @end diff --git a/THPinViewController/THPinViewController.m b/THPinViewController/THPinViewController.m index 6ff581d..c8bc1a1 100644 --- a/THPinViewController/THPinViewController.m +++ b/THPinViewController/THPinViewController.m @@ -78,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