Skip to content

Commit 4677e75

Browse files
author
Gdxy
committed
UI样式进一步与UIAlertController靠近
1 parent 9cb69fd commit 4677e75

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

TLAlertController/TLAlertLib/TLAlertController.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,9 @@ - (void)initProperties {
522522
self.effectStyle = UIBlurEffectStyleExtraLight;
523523
}
524524

525-
NSString *titleColor = _preferredStyle == TLAlertControllerStyleAlert ? @"#101010" : @"#878889";
526-
NSString *msgeColor = _preferredStyle == TLAlertControllerStyleAlert ? @"#181818" : @"#959698";
525+
BOOL isAlert = _preferredStyle == TLAlertControllerStyleAlert;
526+
NSString *titleColor = isAlert ? @"#101010" : @"#878889";
527+
NSString *msgeColor = isAlert ? @"#181818" : @"#959698";
527528

528529
self.separatorColor = [TLAlertController colorWithHex:isDarkMode ? @"#999" : @"#AAA"];
529530
self.titleColor = [TLAlertController colorWithHex:isDarkMode ? @"#FFF" : titleColor];
@@ -532,19 +533,19 @@ - (void)initProperties {
532533
self.textColorOfCancel = [TLAlertController colorWithHex:@"#097FFF"];
533534
self.textColorOfDestructive = [TLAlertController colorWithHex:@"#FF4238"];
534535

535-
self.titleFont = [UIFont boldSystemFontOfSize:13];
536+
self.titleFont = [UIFont systemFontOfSize:(isAlert ? 17 : 13) weight:UIFontWeightSemibold];
536537
self.messageFont = [UIFont systemFontOfSize:13];
537538
self.textFontOfDefault = [UIFont systemFontOfSize:17];
538-
self.textFontOfCancel = [UIFont boldSystemFontOfSize:17];
539+
self.textFontOfCancel = [UIFont systemFontOfSize:17 weight:isAlert ? UIFontWeightRegular : UIFontWeightSemibold];
539540
self.textFontOfDestructive = [UIFont systemFontOfSize:17];
540541

541542
self.actionBgColorOfHighlighted = [UIColor colorWithWhite:0 alpha:isDarkMode ? 0.13 : 0.04];
542543
self.backgroundColorOfCancelView = [TLAlertController colorWithHex:isDarkMode ? @"#2C2C2E" : @"#FFF"];;
543544

544545
self.btns = [NSMutableDictionary dictionary];
545546

546-
self.rowHeight = _preferredStyle == TLAlertControllerStyleAlert ? kAlertRowHeight : kRowHeight;
547-
self.separatorLineHeight = _preferredStyle == TLAlertControllerStyleAlert ? kAlertSeparatorLineHeight : kSeparatorLineHeight;
547+
self.rowHeight = isAlert ? kAlertRowHeight : kRowHeight;
548+
self.separatorLineHeight = isAlert ? kAlertSeparatorLineHeight : kSeparatorLineHeight;
548549

549550
self.cornerRadius = kCornerRadius;
550551
self.margin = kMargin;

0 commit comments

Comments
 (0)