Skip to content

Commit

Permalink
Merge pull request #1362 from stripe/davidme/ios13-topbar
Browse files Browse the repository at this point in the history
Fix Large Title support in iOS 13
  • Loading branch information
davidme-stripe authored Sep 9, 2019
2 parents c4124f0 + f91fd2d commit a74e7d5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Stripe/UIBarButtonItem+Stripe.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ - (void)stp_setTheme:(STPTheme *)theme {
NSForegroundColorAttributeName: theme.secondaryForegroundColor,
}
forState:UIControlStateDisabled];
[self setTitleTextAttributes:@{
NSFontAttributeName: self.style == UIBarButtonItemStylePlain ? theme.font : theme.emphasisFont,
NSForegroundColorAttributeName: theme.accentColor,
}
forState:UIControlStateHighlighted];
}

@end
Expand Down
34 changes: 34 additions & 0 deletions Stripe/UINavigationBar+Stripe_Theme.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ - (void)setStp_theme:(STPTheme *)theme {
NSFontAttributeName: theme.emphasisFont,
NSForegroundColorAttributeName: theme.primaryForegroundColor,
};

#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
self.standardAppearance.backgroundColor = theme.secondaryBackgroundColor;
self.standardAppearance.titleTextAttributes = self.titleTextAttributes;
self.standardAppearance.largeTitleTextAttributes = self.largeTitleTextAttributes;
self.standardAppearance.buttonAppearance.normal.titleTextAttributes = @{
NSFontAttributeName: theme.font,
NSForegroundColorAttributeName: theme.accentColor,
};
self.standardAppearance.buttonAppearance.highlighted.titleTextAttributes = @{
NSFontAttributeName: theme.font,
NSForegroundColorAttributeName: theme.accentColor,
};
self.standardAppearance.buttonAppearance.disabled.titleTextAttributes = @{
NSFontAttributeName: theme.font,
NSForegroundColorAttributeName: theme.secondaryForegroundColor,
};
self.standardAppearance.doneButtonAppearance.normal.titleTextAttributes = @{
NSFontAttributeName: theme.emphasisFont,
NSForegroundColorAttributeName: theme.accentColor,
};
self.standardAppearance.doneButtonAppearance.highlighted.titleTextAttributes = @{
NSFontAttributeName: theme.emphasisFont,
NSForegroundColorAttributeName: theme.accentColor,
};
self.standardAppearance.doneButtonAppearance.disabled.titleTextAttributes = @{
NSFontAttributeName: theme.emphasisFont,
NSForegroundColorAttributeName: theme.secondaryForegroundColor,
};
self.scrollEdgeAppearance = self.standardAppearance;
self.compactAppearance = self.standardAppearance;
}
#endif
}


Expand Down

0 comments on commit a74e7d5

Please sign in to comment.