Skip to content

Commit

Permalink
Merge pull request ResearchKit#75 from dephillipsmichael/feature/FPHS…
Browse files Browse the repository at this point in the history
…-401

feature/FPHS-401
  • Loading branch information
Erin-Mounts committed Feb 12, 2016
2 parents 8d973ad + eac87cf commit e203ab8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
Expand Up @@ -34,6 +34,7 @@
#import "APCAppearanceInfo.h"
#import "UIColor+APCAppearance.h"
#import "APCConstants.h"
#import "UIFont+APCAppearance.h"

static NSDictionary * localAppearanceDictionary;

Expand All @@ -49,9 +50,9 @@ + (NSDictionary *)defaultAppearanceDictionary
{
return @{
//Fonts
kRegularFontNameKey : @"HelveticaNeue",
kMediumFontNameKey : @"HelveticaNeue-Medium",
kLightFontNameKey : @"HelveticaNeue-Light",
kRegularFontNameKey : kAPCAppearanceSystemFont,
kMediumFontNameKey : kAPCAppearanceSystemFont,
kLightFontNameKey : kAPCAppearanceSystemFont,

//Colors
kPrimaryAppColorKey : [UIColor colorWithRed:0.176 green:0.706 blue:0.980 alpha:1.000], //#2db4fa
Expand Down
Expand Up @@ -33,6 +33,8 @@

#import <UIKit/UIKit.h>

static NSString* const kAPCAppearanceSystemFont = @"kAPCAppearanceSystemFont";

@interface UIFont (APCAppearance)

+ (UIFont*) appRegularFontWithSize: (CGFloat) size;
Expand Down
Expand Up @@ -39,17 +39,53 @@ @implementation UIFont (APCAppearance)

+ (UIFont*) appRegularFontWithSize: (CGFloat) size
{
return [UIFont fontWithName:[APCAppearanceInfo valueForAppearanceKey:kRegularFontNameKey] size:size];
NSString* fontName = [APCAppearanceInfo valueForAppearanceKey:kRegularFontNameKey];
if ([fontName isEqualToString:kAPCAppearanceSystemFont])
{
if ([[UIFont class] respondsToSelector:@selector(systemFontOfSize:weight:)])
{
return [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
}
else // iOS version less than 8.2
{
return [UIFont systemFontOfSize:size];
}
}
return [UIFont fontWithName:fontName size:size];
}

+ (UIFont*) appMediumFontWithSize: (CGFloat) size
{
return [UIFont fontWithName:[APCAppearanceInfo valueForAppearanceKey:kMediumFontNameKey] size:size];
NSString* fontName = [APCAppearanceInfo valueForAppearanceKey:kMediumFontNameKey];
if ([fontName isEqualToString:kAPCAppearanceSystemFont])
{
if ([[UIFont class] respondsToSelector:@selector(systemFontOfSize:weight:)])
{
return [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
}
else // iOS version less than 8.2
{
return [UIFont boldSystemFontOfSize:size];
}
}
return [UIFont fontWithName:fontName size:size];
}

+ (UIFont*) appLightFontWithSize: (CGFloat) size
{
return [UIFont fontWithName:[APCAppearanceInfo valueForAppearanceKey:kLightFontNameKey] size:size];
NSString* fontName = [APCAppearanceInfo valueForAppearanceKey:kLightFontNameKey];
if ([fontName isEqualToString:kAPCAppearanceSystemFont])
{
if ([[UIFont class] respondsToSelector:@selector(systemFontOfSize:weight:)])
{
return [UIFont systemFontOfSize:size weight:UIFontWeightLight];
}
else // iOS version less than 8.2
{
return [UIFont systemFontOfSize:size];
}
}
return [UIFont fontWithName:fontName size:size];
}

+ (UIFont*) appNavBarTitleFont {
Expand Down

0 comments on commit e203ab8

Please sign in to comment.