From b529e2be207fc61790ebc81f9b2696178d911ea9 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Thu, 17 Dec 2015 09:33:29 +0100 Subject: [PATCH 1/3] Add table section header/footer configuration --- WordPress-iOS-Shared/Core/WPStyleGuide.h | 2 ++ WordPress-iOS-Shared/Core/WPStyleGuide.m | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/WordPress-iOS-Shared/Core/WPStyleGuide.h b/WordPress-iOS-Shared/Core/WPStyleGuide.h index 08ef999..7fecba0 100644 --- a/WordPress-iOS-Shared/Core/WPStyleGuide.h +++ b/WordPress-iOS-Shared/Core/WPStyleGuide.h @@ -69,6 +69,8 @@ + (void)configureTableViewActionCell:(UITableViewCell *)cell; + (void)configureTableViewDestructiveActionCell:(UITableViewCell *)cell; + (void)configureTableViewTextCell:(WPTextFieldTableViewCell *)cell; ++ (void)configureTableViewSectionHeader:(UITableViewHeaderFooterView *)header; ++ (void)configureTableViewSectionFooter:(UITableViewHeaderFooterView *)footer; // Move to a feature category + (UIColor *)buttonActionColor; diff --git a/WordPress-iOS-Shared/Core/WPStyleGuide.m b/WordPress-iOS-Shared/Core/WPStyleGuide.m index 5856e37..43d3cb1 100644 --- a/WordPress-iOS-Shared/Core/WPStyleGuide.m +++ b/WordPress-iOS-Shared/Core/WPStyleGuide.m @@ -413,6 +413,18 @@ + (void)configureTableViewTextCell:(WPTextFieldTableViewCell *)cell } } ++ (void)configureTableViewSectionHeader:(UITableViewHeaderFooterView *)header +{ + header.textLabel.font = [self tableviewSectionHeaderFont]; + header.textLabel.textColor = [self whisperGrey]; +} + ++ (void)configureTableViewSectionFooter:(UITableViewHeaderFooterView *)footer +{ + footer.textLabel.font = [self subtitleFont]; + footer.textLabel.textColor = [self greyDarken10]; +} + // TODO: Move to fetaure category + (void)configureFollowButton:(UIButton *)followButton { followButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; From c093eecd9dd4cd05e96e45a64f343679d0317696 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Thu, 17 Dec 2015 09:34:01 +0100 Subject: [PATCH 2/3] Deprecate WPTableViewSectionHeaderFooterView --- WordPress-iOS-Shared/Core/WPTableViewSectionHeaderFooterView.h | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress-iOS-Shared/Core/WPTableViewSectionHeaderFooterView.h b/WordPress-iOS-Shared/Core/WPTableViewSectionHeaderFooterView.h index ee430ec..f34b311 100644 --- a/WordPress-iOS-Shared/Core/WPTableViewSectionHeaderFooterView.h +++ b/WordPress-iOS-Shared/Core/WPTableViewSectionHeaderFooterView.h @@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, WPTableViewSectionStyle) * should be used app-wide. */ +__deprecated_msg("Use +[WPStyleGuide configureTableViewSectionHeader:] from the table view delegate instead") @interface WPTableViewSectionHeaderFooterView : UITableViewHeaderFooterView @property (nonatomic, assign, readonly) WPTableViewSectionStyle style; From 9882a89e3549f5be42361de4e3eddaaf750523d1 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Thu, 17 Dec 2015 15:04:58 +0100 Subject: [PATCH 3/3] Accept plain views as section header/footer It makes integration with Swift easier. If the view is not a UITableViewHeaderFooterView, we don't touch it. --- WordPress-iOS-Shared/Core/WPStyleGuide.h | 4 ++-- WordPress-iOS-Shared/Core/WPStyleGuide.m | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/WordPress-iOS-Shared/Core/WPStyleGuide.h b/WordPress-iOS-Shared/Core/WPStyleGuide.h index 7fecba0..1684774 100644 --- a/WordPress-iOS-Shared/Core/WPStyleGuide.h +++ b/WordPress-iOS-Shared/Core/WPStyleGuide.h @@ -69,8 +69,8 @@ + (void)configureTableViewActionCell:(UITableViewCell *)cell; + (void)configureTableViewDestructiveActionCell:(UITableViewCell *)cell; + (void)configureTableViewTextCell:(WPTextFieldTableViewCell *)cell; -+ (void)configureTableViewSectionHeader:(UITableViewHeaderFooterView *)header; -+ (void)configureTableViewSectionFooter:(UITableViewHeaderFooterView *)footer; ++ (void)configureTableViewSectionHeader:(UIView *)header; ++ (void)configureTableViewSectionFooter:(UIView *)footer; // Move to a feature category + (UIColor *)buttonActionColor; diff --git a/WordPress-iOS-Shared/Core/WPStyleGuide.m b/WordPress-iOS-Shared/Core/WPStyleGuide.m index 43d3cb1..3a23d19 100644 --- a/WordPress-iOS-Shared/Core/WPStyleGuide.m +++ b/WordPress-iOS-Shared/Core/WPStyleGuide.m @@ -415,12 +415,18 @@ + (void)configureTableViewTextCell:(WPTextFieldTableViewCell *)cell + (void)configureTableViewSectionHeader:(UITableViewHeaderFooterView *)header { + if (![header isKindOfClass:[UITableViewHeaderFooterView class]]) { + return; + } header.textLabel.font = [self tableviewSectionHeaderFont]; header.textLabel.textColor = [self whisperGrey]; } + (void)configureTableViewSectionFooter:(UITableViewHeaderFooterView *)footer { + if (![footer isKindOfClass:[UITableViewHeaderFooterView class]]) { + return; + } footer.textLabel.font = [self subtitleFont]; footer.textLabel.textColor = [self greyDarken10]; }