clean up some fonts method

This commit is contained in:
panxi 2019-03-28 11:19:18 -04:00
parent 6ee6170031
commit b43690d10e
6 changed files with 72 additions and 134 deletions

View File

@ -50,8 +50,6 @@
+ (nonnull MFLabel *)label NS_SWIFT_NAME(commonLabel());
//75Bd 15pt
+ (nonnull MFLabel *)commonLabelHeadlineSmall:(BOOL)scale;
//75Bd 16pt
+ (nonnull MFLabel *)commonLabelFeedTitle:(BOOL)scale;
// Setters
+ (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html;
@ -66,7 +64,6 @@
- (void)styleFeedHeadline:(BOOL)scale;
- (void)styleFeedMessage:(BOOL)scale;
- (void)styleFeedTitle:(BOOL)scale;
- (void)styleHeadlineSmall:(BOOL)scale;
@end

View File

@ -166,12 +166,6 @@
return label;
}
+ (nonnull MFLabel *)commonLabelFeedTitle:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleFeedTitle:scale];
return label;
}
#pragma mark - Setters
+ (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html {
@ -297,11 +291,6 @@
[self setScale:scale];
}
- (void)styleFeedTitle:(BOOL)scale {
[MFStyler styleFeedCardTitleLabel:self genericScaling:NO];
[self setScale:scale];
}
- (void)setAccessibilityTraits:(UIAccessibilityTraits)accessibilityTraits {
if (accessibilityTraits& UIAccessibilityTraitHeader) {

View File

@ -114,11 +114,9 @@ B3 -> Legal
//55Rg 11pt
+ (nullable UIFont *)fontB3:(BOOL)genericScaling;
+ (nullable UIFont *)fontB3;
//55Rg 14pt
+ (nullable UIFont *)fontB4:(BOOL)genericScaling;
+ (nullable UIFont *)fontB4;
//55Rg 20pt
+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling;
+ (nullable UIFont *)fontForFeedMessage;
#pragma mark - 1.0 fonts
@ -127,9 +125,8 @@ B3 -> Legal
+ (nullable UIFont *)fontForPlan;
//75Bd 48pt
+ (nullable UIFont *)fontForBiggerHeadline;
//75Bd 40pt
//75Bd 32pt
+ (nullable UIFont *)fontForFeedHeadline;
//75Bd 15pt
+ (nullable UIFont *)fontForHeadlineSmall;
//75Bd 11pt
@ -172,8 +169,9 @@ B3 -> Legal
+ (nullable UIFont *)fontForUnreadMessageOnSupport;
// Returns the fonts for these styles allowing to apply a generic scale by device or not.
+ (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling;
+ (nullable UIFont *)fontForPlan:(BOOL)genericScaling;
+ (nullable UIFont *)fontForFeedHeadline:(BOOL)genericScaling;
+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling;
+ (nullable UIFont *)fontForHeadlineSmall:(BOOL)genericScaling;
+ (nullable UIFont *)fontForHeadlineSmall2:(BOOL)genericScaling;
+ (nullable UIFont *)fontForHeadlineSmall2ForWidth:(CGFloat)size;
@ -225,15 +223,13 @@ B3 -> Legal
+ (void)styleLabelB1:(nonnull UILabel *)label;
+ (void)styleLabelB1:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
+ (void)styleLabelB2:(nonnull UILabel *)label;
+ (void)styleLabelB2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
+ (void)styleLabelB2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling;
+ (void)styleLabelB3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
+ (void)styleLabelB3:(nonnull UILabel *)label;
+ (void)styleLabelB4:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
+ (void)styleLabelB4:(nonnull UILabel *)label;
+ (void)styleLabelTextStyle2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
+ (void)styleLabelTextStyle2:(nonnull UILabel *)label;
@ -241,13 +237,10 @@ B3 -> Legal
+ (void)styleLabelHeadlineFeed:(nonnull UILabel *)label;
+ (void)styleLabelFeedMessage:(nonnull UILabel *)label;
+ (void)styleLabelB2:(nonnull UILabel *)label;
+ (void)styleFeedCardTitleLabel:(nonnull UILabel *)label;
+ (void)styleFeedCardTagLabel:(nonnull UILabel *)label;
+ (void)styleStandardSeparatorView:(nonnull UIView *)view;
+ (void)styleLabelHeadlineSmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling;
@ -264,10 +257,12 @@ B3 -> Legal
+ (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string font:(nonnull UIFont *)font color:(nonnull UIColor *)color;
+ (nonnull NSAttributedString *)styleGetHeadlineAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetSubheadAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetBodyAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetB1AttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetDisabledBodyAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetLegalAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetSubtitleAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetDisabledSubtitleAttributedString:(nullable NSString *)string;
+ (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftString:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color;

View File

@ -126,8 +126,56 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [self fontH3:YES];
}
+ (nullable UIFont *)fontB1:(BOOL)genericScaling {
CGFloat size = 13;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontB1 {
return [self fontB1:YES];
}
+ (nullable UIFont *)fontB2:(BOOL)genericScaling {
CGFloat size = 13;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontB2 {
return [self fontB2:YES];
}
+ (nullable UIFont *)fontB3:(BOOL)genericScaling {
CGFloat size = 11;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontB3 {
return [self fontB3:YES];
}
#pragma mark - Fonts
+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling {
CGFloat size = 20;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontForFeedMessage {
return [self fontForFeedMessage:YES];
}
+ (nullable UIFont *)fontForPlan:(BOOL)genericScaling {
CGFloat size = 100;
if (genericScaling) {
@ -136,6 +184,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontForPlan {
return [self fontForPlan:YES];
}
+ (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling {
CGFloat size = 48;
if (genericScaling) {
@ -144,6 +196,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontForBiggerHeadline {
return [self fontForBiggerHeadLine:YES];
}
+ (nullable UIFont *)fontForFeedHeadline:(BOOL)genericScaling {
CGFloat size = 32;
if (genericScaling) {
@ -152,12 +208,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling {
CGFloat size = 20;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
+ (nullable UIFont *)fontForFeedHeadline {
return [self fontForFeedHeadline:YES];
}
+ (nullable UIFont *)fontForHeadlineSmall:(BOOL)genericScaling {
@ -182,28 +234,12 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont75Bd:pointSize];
}
+ (nullable UIFont *)commonLabelB1:(BOOL)genericScaling {
CGFloat size = 13;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontB1ForWidth:(CGFloat)size {
CGFloat pointSize = 13;
pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
return [MFFonts mfFont75Bd:pointSize];
}
+ (nullable UIFont *)fontB2:(BOOL)genericScaling {
CGFloat size = 13;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontForBodyWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling {
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
@ -238,14 +274,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontB3:(BOOL)genericScaling {
CGFloat size = 11;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontForProgressBarBottomLabel:(BOOL)genericScaling {
CGFloat size = 10;
if (genericScaling) {
@ -254,14 +282,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontB1:(BOOL)genericScaling {
CGFloat size = 13;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontForPrimaryButton:(BOOL)genericScaling {
CGFloat size = 14;
if (genericScaling) {
@ -344,14 +364,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont75Bd:size];
}
+ (nullable UIFont *)fontB4:(BOOL)genericScaling {
CGFloat size = 14;
if (genericScaling) {
size = [self sizeFontGenericForCurrentDevice:size];
}
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)fontForSupportQuestionMark:(BOOL)genericScaling {
CGFloat size = 18;
if (genericScaling) {
@ -422,22 +434,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFontOcratxt:size];
}
+ (nullable UIFont *)fontForPlan {
return [self fontForPlan:YES];
}
+ (nullable UIFont *)fontForBiggerHeadline {
return [self fontForBiggerHeadLine:YES];
}
+ (nullable UIFont *)fontForFeedHeadline {
return [self fontForFeedHeadline:YES];
}
+ (nullable UIFont *)fontForFeedMessage {
return [self fontForFeedMessage:YES];
}
+ (nullable UIFont *)fontForHeadlineSmall {
return [self fontForHeadlineSmall:YES];
}
@ -450,10 +446,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [self fontForHeadlineSmall2:YES];
}
+ (nullable UIFont *)fontB2 {
return [self fontB2:YES];
}
+ (nullable UIFont *)fontforChatText {
return [self fontforChatText:NO];
}
@ -462,18 +454,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [self fontForAccountLandingGreeting:YES];
}
+ (nullable UIFont *)fontB3 {
return [self fontB3:YES];
}
+ (nullable UIFont *)fontForProgressBarBottomLabel {
return [self fontForProgressBarBottomLabel:YES];
}
+ (nullable UIFont *)fontB1 {
return [self fontB1:YES];
}
+ (nullable UIFont *)fontForPrimaryButton {
return [self fontForPrimaryButton:YES];
}
@ -498,10 +482,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [self fontForFeedCardTitle:YES];
}
+ (nullable UIFont *)fontB4 {
return [self fontB4:YES];
}
+ (nullable UIFont *)fontForSupportQuestionMark {
return [self fontForSupportQuestionMark:YES];
}
@ -593,16 +573,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
label.textColor = [UIColor mfBattleshipGrey];
}
+ (void)styleLabelB4:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
label.font = [MFStyler fontB4:genericScaling];
label.textColor = [UIColor blackColor];
}
+ (void)styleLabelB4:(nonnull UILabel *)label {
label.font = [MFStyler fontB4];
label.textColor = [UIColor blackColor];
}
+ (void)styleLabelTextStyle2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
label.font = [MFStyler fontB2:genericScaling];
label.textColor = [UIColor mfBattleshipGrey];
@ -698,7 +668,7 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFStyler styleGetAttributedString:string font:[MFStyler fontH3] color:[UIColor blackColor]];
}
+ (nonnull NSAttributedString *)styleGetBodyAttributedString:(nullable NSString *)string {
+ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string {
return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor blackColor]];
}
@ -710,7 +680,7 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFStyler styleGetAttributedString:string font:[MFStyler fontB1] color:[UIColor mfCharcoalColor]];
}
+ (nonnull NSAttributedString *)styleGetLegalAttributedString:(nullable NSString *)string {
+ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string {
return [MFStyler styleGetAttributedString:string font:[MFStyler fontB3] color:[UIColor mfGrayColor]];
}

View File

@ -26,7 +26,6 @@
+ (nonnull UILabel *)commonLabelB1;
+ (nonnull UILabel *)commonLabelB2;
+ (nonnull UILabel *)commonLabelB3;
+ (nonnull UILabel *)commonLabelB4;
#pragma mark - Labels
@ -34,7 +33,7 @@
+ (nonnull UILabel *)label;
+ (nonnull UILabel *)commonLabelHeadlineFeed;
+ (nonnull UILabel *)commonLabelFeedHeadline;
+ (nonnull UILabel *)commonLabelFeedTitle;
+ (nonnull UILabel *)commonLabelHeadlineSmall;
#pragma mark - Text Field

View File

@ -77,21 +77,15 @@ static const CGFloat VertialShadowOffset = 6;
return label;
}
+ (nonnull UILabel *)commonLabelBody {
UILabel *label = [MVMCoreUICommonViewsUtility label];
[MFStyler styleLabelB2:label];
return label;
}
+ (nonnull UILabel *)commonLabelFeedHeadline {
UILabel *label = [MVMCoreUICommonViewsUtility label];
[MFStyler styleLabelHeadlineFeed:label];
return label;
}
+ (nonnull UILabel *)commonLabelFeedTitle {
+ (nonnull UILabel *)commonLabelHeadlineSmall {
UILabel *label = [MVMCoreUICommonViewsUtility label];
[MFStyler styleFeedCardTitleLabel:label];
[MFStyler styleLabelHeadlineSmall:label genericScaling:YES];
return label;
}
@ -113,12 +107,6 @@ static const CGFloat VertialShadowOffset = 6;
return label;
}
+ (nonnull UILabel *)commonLabelB4 {
UILabel *label = [MVMCoreUICommonViewsUtility label];
[MFStyler styleLabelB4:label];
return label;
}
#pragma mark - Text Field
+ (nonnull UIPickerView *)addPickerToTextField:(nonnull UITextField *)textField delegate:(nullable id <UITextFieldDelegate,UIPickerViewDelegate,UIPickerViewDataSource>)delegate {