Skip to content

Commit 0806d61

Browse files
committed
Added null resettable handlers
1 parent 68025c9 commit 0806d61

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

TOPasscodeViewController/Views/TOPasscodeSettingsKeypadView.m

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,55 @@ - (void)setButtonLabelHorizontalLayout:(BOOL)horizontal animated:(BOOL)animated
302302
}];
303303
}
304304
}
305+
306+
#pragma mark - Null Resettable Accessors -
307+
- (void)setKeypadButtonForegroundColor:(nullable UIColor *)keypadButtonForegroundColor
308+
{
309+
if (keypadButtonForegroundColor == _keypadButtonForegroundColor) { return; }
310+
_keypadButtonForegroundColor = keypadButtonForegroundColor;
311+
312+
if (_keypadButtonForegroundColor == nil) {
313+
BOOL isDark = self.style == TOPasscodeSettingsViewStyleDark;
314+
_keypadButtonForegroundColor = isDark ? [UIColor colorWithWhite:0.3f alpha:1.0f] : [UIColor whiteColor];
315+
}
316+
317+
self.buttonBackgroundImage = nil;
318+
[self setNeedsLayout];
319+
}
320+
321+
- (void)setKeypadButtonBorderColor:(nullable UIColor *)keypadButtonBorderColor
322+
{
323+
if (keypadButtonBorderColor == _keypadButtonBorderColor) { return; }
324+
_keypadButtonBorderColor = keypadButtonBorderColor;
325+
326+
if (_keypadButtonBorderColor == nil) {
327+
BOOL isDark = self.style == TOPasscodeSettingsViewStyleDark;
328+
UIColor *borderColor = nil;
329+
if (isDark) {
330+
borderColor = [UIColor colorWithWhite:0.2 alpha:1.0f];
331+
}
332+
else {
333+
borderColor = [UIColor colorWithRed:166.0f/255.0f green:174.0f/255.0f blue:186.0f/255.0f alpha:1.0f];
334+
}
335+
_keypadButtonBorderColor = borderColor;
336+
}
337+
338+
self.buttonBackgroundImage = nil;
339+
[self setNeedsLayout];
340+
}
341+
342+
- (void)setKeypadButtonTappedForegroundColor:(nullable UIColor *)keypadButtonTappedForegroundColor
343+
{
344+
if (keypadButtonTappedForegroundColor == _keypadButtonTappedForegroundColor) { return; }
345+
_keypadButtonTappedForegroundColor = keypadButtonTappedForegroundColor;
346+
347+
if (_keypadButtonTappedForegroundColor == nil) {
348+
BOOL isDark = self.style == TOPasscodeSettingsViewStyleDark;
349+
_keypadButtonTappedForegroundColor = isDark ? [UIColor colorWithWhite:0.4f alpha:1.0f] : [UIColor colorWithWhite:0.85f alpha:1.0f];
350+
}
351+
352+
self.buttonTappedBackgroundImage = nil;
353+
[self setNeedsLayout];
354+
}
355+
305356
@end

0 commit comments

Comments
 (0)