Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Commit

Permalink
Migrate Hex 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Sep 24, 2015
1 parent 5352175 commit 1199237
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 119 deletions.
5 changes: 3 additions & 2 deletions Demos/Basic-ObjC/Basic-ObjC/AppDelegate/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import "NSObject+HYPTesting.h"
#import "NSJSONSerialization+ANDYJSONFile.h"
#import "UIColor+Hex.h"
@import Hex;

@interface AppDelegate ()

Expand Down Expand Up @@ -40,7 +40,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:sampleController];

controller.view.tintColor = [UIColor colorFromHex:@"5182AF"];
controller.view.tintColor = [[UIColor alloc] initWithHex:@"5182AF"];

controller.navigationBar.translucent = NO;

self.window.rootViewController = controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#import "FORMDefaultStyle.h"

#import "NSObject+HYPTesting.h"
#import "UIColor+Hex.h"
#import "UIViewController+HYPKeyboardToolbar.h"
#import "NSJSONSerialization+ANDYJSONFile.h"
@import Hex;

@interface HYPSampleCollectionViewController () <HYPImagePickerDelegate>

Expand Down Expand Up @@ -58,7 +58,7 @@ - (void)viewDidLoad {

self.collectionView.contentInset = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);

self.collectionView.backgroundColor = [UIColor colorFromHex:@"DAE2EA"];
self.collectionView.backgroundColor = [[UIColor alloc] initWithHex:@"DAE2EA"];

UIBarButtonItem *printValuesButton = [[UIBarButtonItem alloc] initWithTitle:@"Show Values"
style:UIBarButtonItemStyleDone
Expand Down Expand Up @@ -127,13 +127,13 @@ - (void)configureToolbar {

UILabel *readOnlyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 90.0f, 40.0f)];
readOnlyLabel.text = @"Read-only";
readOnlyLabel.textColor = [UIColor colorFromHex:@"5182AF"];
readOnlyLabel.textColor = [[UIColor alloc] initWithHex:@"5182AF"];
readOnlyLabel.font = [UIFont boldSystemFontOfSize:17.0f];
[readOnlyView addSubview:readOnlyLabel];

UISwitch *readOnlySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(90.0f, 5.0f, 40.0f, 40.0f)];
readOnlySwitch.tintColor = [UIColor colorFromHex:@"5182AF"];
readOnlySwitch.onTintColor = [UIColor colorFromHex:@"5182AF"];
readOnlySwitch.tintColor = [[UIColor alloc] initWithHex:@"5182AF"];
readOnlySwitch.onTintColor = [[UIColor alloc] initWithHex:@"5182AF"];
readOnlySwitch.on = YES;
[readOnlySwitch addTarget:self action:@selector(readOnly:) forControlEvents:UIControlEventValueChanged];
[readOnlyView addSubview:readOnlySwitch];
Expand Down
8 changes: 4 additions & 4 deletions Demos/Basic-ObjC/Basic-ObjC/Views/HYPImageFormFieldCell.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "HYPImageFormFieldCell.h"

#import "UIColor+Hex.h"
@import Hex;

static const CGFloat HYPImageFormFieldTopMargin = 20.0f;
static const CGFloat HYPImageFormFieldHorizontalMargin = 10.0f;
Expand All @@ -27,7 +27,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) return nil;

self.contentView.backgroundColor = [UIColor colorFromHex:@"F5F5F8"];
self.contentView.backgroundColor = [[UIColor alloc] initWithHex:@"F5F5F8"];

self.contentView.layer.cornerRadius = 5.0f;
self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Expand All @@ -53,7 +53,7 @@ - (UILabel *)label {
HYPImageFormFieldLabelsWidth, HYPImageFormFieldLabelHeight);
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
label.font = [UIFont fontWithName:@"DIN-Medium" size:20.0];
label.textColor = [UIColor colorFromHex:@"28649C"];
label.textColor = [[UIColor alloc] initWithHex:@"28649C"];
label.text = NSLocalizedString(@"Main Title", nil);

return label;
Expand All @@ -64,7 +64,7 @@ - (UILabel *)info {
HYPImageFormFieldLabelsWidth, HYPImageFormFieldInfoHeight);
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoFrame];
infoLabel.font = [UIFont fontWithName:@"DIN-Regular" size:14.0];
infoLabel.textColor = [UIColor colorFromHex:@"28649C"];
infoLabel.textColor = [[UIColor alloc] initWithHex:@"28649C"];
infoLabel.text = NSLocalizedString(@"Some info on the button", nil);
infoLabel.lineBreakMode = NSLineBreakByWordWrapping;
infoLabel.numberOfLines = 0;
Expand Down
10 changes: 5 additions & 5 deletions Demos/Basic-ObjC/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Form (3.6.1):
- Hex (~> 1.1.1)
- Form (3.6.2):
- Hex (~> 2.0)
- HYP8601 (~> 0.7.2)
- HYPMathParser (~> 0.4.1)
- HYPNorwegianAccountNumber (~> 1.2.1)
Expand All @@ -16,7 +16,7 @@ PODS:
- NSString-ZENInflections (~> 1.2)
- UIButton-ANDYHighlighted (~> 0.2.1)
- UIViewController-HYPKeyboardToolbar (~> 0.1)
- Hex (1.1.1)
- Hex (2.0)
- HYP8601 (0.7.2)
- HYPImagePicker (0.3)
- HYPMathParser (0.4.1)
Expand Down Expand Up @@ -45,8 +45,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Form: 0e78a4ea95c9a41a11cd0f9e3d0eb0359fc5d2fe
Hex: acf6d0dc34658d3d44047a992bfd09190c87e6e7
Form: a36099d9652a32437932cb7461685fc4b95450dd
Hex: 1800bd20206b93b10422d2289baa3787698825ad
HYP8601: 0118757c1332620748c75e7218e7b6b849686d06
HYPImagePicker: 5c6e463ec15ae6b647355eb11f3f310342616fbf
HYPMathParser: 146a4981427a0b46cc9af823b210bfefdf0a7107
Expand Down
10 changes: 5 additions & 5 deletions Demos/Basic-Swift/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Form (3.6.1):
- Hex (~> 1.1.1)
- Form (3.6.2):
- Hex (~> 2.0)
- HYP8601 (~> 0.7.2)
- HYPMathParser (~> 0.4.1)
- HYPNorwegianAccountNumber (~> 1.2.1)
Expand All @@ -16,7 +16,7 @@ PODS:
- NSString-ZENInflections (~> 1.2)
- UIButton-ANDYHighlighted (~> 0.2.1)
- UIViewController-HYPKeyboardToolbar (~> 0.1)
- Hex (1.1.1)
- Hex (2.0)
- HYP8601 (0.7.2)
- HYPMathParser (0.4.1)
- HYPNorwegianAccountNumber (1.2.1)
Expand All @@ -43,8 +43,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Form: 0e78a4ea95c9a41a11cd0f9e3d0eb0359fc5d2fe
Hex: acf6d0dc34658d3d44047a992bfd09190c87e6e7
Form: a36099d9652a32437932cb7461685fc4b95450dd
Hex: 1800bd20206b93b10422d2289baa3787698825ad
HYP8601: 0118757c1332620748c75e7218e7b6b849686d06
HYPMathParser: 146a4981427a0b46cc9af823b210bfefdf0a7107
HYPNorwegianAccountNumber: b0062d7419d217123dff0ef04f1931ed5f1e3bbf
Expand Down
10 changes: 5 additions & 5 deletions Demos/CustomField/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Form (3.6.1):
- Hex (~> 1.1.1)
- Form (3.6.2):
- Hex (~> 2.0)
- HYP8601 (~> 0.7.2)
- HYPMathParser (~> 0.4.1)
- HYPNorwegianAccountNumber (~> 1.2.1)
Expand All @@ -16,7 +16,7 @@ PODS:
- NSString-ZENInflections (~> 1.2)
- UIButton-ANDYHighlighted (~> 0.2.1)
- UIViewController-HYPKeyboardToolbar (~> 0.1)
- Hex (1.1.1)
- Hex (2.0)
- HYP8601 (0.7.2)
- HYPMathParser (0.4.1)
- HYPNorwegianAccountNumber (1.2.1)
Expand All @@ -43,8 +43,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Form: 0e78a4ea95c9a41a11cd0f9e3d0eb0359fc5d2fe
Hex: acf6d0dc34658d3d44047a992bfd09190c87e6e7
Form: a36099d9652a32437932cb7461685fc4b95450dd
Hex: 1800bd20206b93b10422d2289baa3787698825ad
HYP8601: 0118757c1332620748c75e7218e7b6b849686d06
HYPMathParser: 146a4981427a0b46cc9af823b210bfefdf0a7107
HYPNorwegianAccountNumber: b0062d7419d217123dff0ef04f1931ed5f1e3bbf
Expand Down
10 changes: 5 additions & 5 deletions Demos/Login-demo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Form (3.6.1):
- Hex (~> 1.1.1)
- Form (3.6.2):
- Hex (~> 2.0)
- HYP8601 (~> 0.7.2)
- HYPMathParser (~> 0.4.1)
- HYPNorwegianAccountNumber (~> 1.2.1)
Expand All @@ -16,7 +16,7 @@ PODS:
- NSString-ZENInflections (~> 1.2)
- UIButton-ANDYHighlighted (~> 0.2.1)
- UIViewController-HYPKeyboardToolbar (~> 0.1)
- Hex (1.1.1)
- Hex (2.0)
- HYP8601 (0.7.2)
- HYPMathParser (0.4.1)
- HYPNorwegianAccountNumber (1.2.1)
Expand All @@ -43,8 +43,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Form: 0e78a4ea95c9a41a11cd0f9e3d0eb0359fc5d2fe
Hex: acf6d0dc34658d3d44047a992bfd09190c87e6e7
Form: a36099d9652a32437932cb7461685fc4b95450dd
Hex: 1800bd20206b93b10422d2289baa3787698825ad
HYP8601: 0118757c1332620748c75e7218e7b6b849686d06
HYPMathParser: 146a4981427a0b46cc9af823b210bfefdf0a7107
HYPNorwegianAccountNumber: b0062d7419d217123dff0ef04f1931ed5f1e3bbf
Expand Down
10 changes: 5 additions & 5 deletions Demos/iPhone-Storyboard/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Form (3.6.1):
- Hex (~> 1.1.1)
- Form (3.6.2):
- Hex (~> 2.0)
- HYP8601 (~> 0.7.2)
- HYPMathParser (~> 0.4.1)
- HYPNorwegianAccountNumber (~> 1.2.1)
Expand All @@ -16,7 +16,7 @@ PODS:
- NSString-ZENInflections (~> 1.2)
- UIButton-ANDYHighlighted (~> 0.2.1)
- UIViewController-HYPKeyboardToolbar (~> 0.1)
- Hex (1.1.1)
- Hex (2.0)
- HYP8601 (0.7.2)
- HYPMathParser (0.4.1)
- HYPNorwegianAccountNumber (1.2.1)
Expand All @@ -43,8 +43,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Form: 0e78a4ea95c9a41a11cd0f9e3d0eb0359fc5d2fe
Hex: acf6d0dc34658d3d44047a992bfd09190c87e6e7
Form: a36099d9652a32437932cb7461685fc4b95450dd
Hex: 1800bd20206b93b10422d2289baa3787698825ad
HYP8601: 0118757c1332620748c75e7218e7b6b849686d06
HYPMathParser: 146a4981427a0b46cc9af823b210bfefdf0a7107
HYPNorwegianAccountNumber: b0062d7419d217123dff0ef04f1931ed5f1e3bbf
Expand Down
4 changes: 2 additions & 2 deletions Form.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Form"
s.version = "3.6.1"
s.version = "3.6.2"
s.summary = "JSON driven form"
s.homepage = "https://github.com/hyperoslo/Form"
s.license = {
Expand All @@ -21,7 +21,7 @@ Pod::Spec.new do |s|
s.frameworks = 'Foundation'
s.requires_arc = true

s.dependency 'Hex', '~> 1.1.1'
s.dependency 'Hex', '~> 2.0'
s.dependency 'HYP8601', '~> 0.7.2'
s.dependency 'HYPMathParser', '~> 0.4.1'
s.dependency 'HYPNorwegianAccountNumber', '~> 1.2.1'
Expand Down
2 changes: 1 addition & 1 deletion Source/Cells/Base/FORMBaseFieldCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ - (void)setHeadingLabelFont:(UIFont *)font {
- (void)setHeadingLabelTextColor:(UIColor *)color {
NSString *style = [self.styles valueForKey:FORMHeadingLabelTextColorKey];
if ([style length] > 0) {
color = [UIColor colorFromHex:style];
color = [[UIColor alloc] initWithHex:style];
}

self.headingLabel.textColor = color;
Expand Down
12 changes: 6 additions & 6 deletions Source/Cells/Button/FORMButtonFieldCell.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "FORMButtonFieldCell.h"
#import "UIButton+ANDYHighlighted.h"
#import "UIColor+Hex.h"
@import Hex;

static NSString * const FORMButtonTitleLabelFontKey = @"font";
static NSString * const FORMButtonTitleLabelFontSizeKey = @"font_size";
Expand Down Expand Up @@ -121,39 +121,39 @@ - (void)setCornerRadius:(CGFloat)cornerRadius {
- (void)setHighlightedTitleColor:(UIColor *)highlightedTitleColor {
NSString *style = [self.field.styles valueForKey:FORMButtonHighlightedTitleColorKey];
if ([style length] > 0) {
highlightedTitleColor = [UIColor colorFromHex:style];
highlightedTitleColor = [[UIColor alloc] initWithHex:style];
}
self.button.highlightedTitleColor = highlightedTitleColor;
}

- (void)setBorderColor:(UIColor *)borderColor {
NSString *style = [self.field.styles valueForKey:FORMButtonBorderColorKey];
if ([style length] > 0) {
borderColor = [UIColor colorFromHex:style];
borderColor = [[UIColor alloc] initWithHex:style];
}
self.button.layer.borderColor = borderColor.CGColor;
}

- (void)setHighlightedBackgroundColor:(UIColor *)highlightedBackgroundColor {
NSString *style = [self.field.styles valueForKey:FORMButtonHighlightedBackgroundColorKey];
if ([style length] > 0) {
highlightedBackgroundColor = [UIColor colorFromHex:style];
highlightedBackgroundColor = [[UIColor alloc] initWithHex:style];
}
self.button.highlightedBackgroundColor = highlightedBackgroundColor;
}

- (void)setTitleColor:(UIColor *)titleColor {
NSString *style = [self.field.styles valueForKey:FORMButtonTitleColorKey];
if ([style length] > 0) {
titleColor = [UIColor colorFromHex:style];
titleColor = [[UIColor alloc] initWithHex:style];
}
self.button.titleColor = titleColor;
}

- (void)setBackgroundColor:(UIColor *)backgroundColor {
NSString *style = [self.field.styles valueForKey:FORMButtonBackgroundColorKey];
if ([style length] > 0) {
backgroundColor = [UIColor colorFromHex:style];
backgroundColor = [[UIColor alloc] initWithHex:style];
}
self.button.backgroundColor = backgroundColor;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Cells/Text/FORMTextFieldCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,15 @@ - (void)setTooltipLabelFont:(UIFont *)tooltipLabelFont {
- (void)setTooltipLabelTextColor:(UIColor *)tooltipLabelTextColor {
NSString *style = [self.field.styles valueForKey:FORMTooltipLabelTextColorKey];
if ([style length] > 0) {
tooltipLabelTextColor = [UIColor colorFromHex:style];
tooltipLabelTextColor = [[UIColor alloc] initWithHex:style];
}
self.tooltipLabel.textColor = tooltipLabelTextColor;
}

- (void)setTooltipBackgroundColor:(UIColor *)tooltipBackgroundColor {
NSString *style = [self.field.styles valueForKey:FORMTooltipBackgroundColorKey];
if ([style length] > 0) {
tooltipBackgroundColor = [UIColor colorFromHex:style];
tooltipBackgroundColor = [[UIColor alloc] initWithHex:style];
}
[FORMTooltipView setTintColor:tooltipBackgroundColor];
}
Expand Down
Loading

0 comments on commit 1199237

Please sign in to comment.