Skip to content
This repository was archived by the owner on Jun 13, 2021. It is now read-only.

Commit acec143

Browse files
committed
Updated to 2.0.3
* Added `HidesNavigationBarHairline` boolean, and by default it is now set to `NO`. * Edited Quick Look Documentation for several methods.
1 parent 88a6274 commit acec143

6 files changed

+61
-14
lines changed

ChameleonDemo/Base.lproj/Main.storyboard

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A282b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Xln-K6-UFC">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9046" systemVersion="14F25a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Xln-K6-UFC">
33
<dependencies>
44
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9035"/>
66
</dependencies>
77
<scenes>
88
<!--Title goes Here-->
@@ -78,7 +78,7 @@
7878
</navigationController>
7979
<placeholder placeholderIdentifier="IBFirstResponder" id="A2b-rc-aii" userLabel="First Responder" sceneMemberID="firstResponder"/>
8080
</objects>
81-
<point key="canvasLocation" x="581" y="1045"/>
81+
<point key="canvasLocation" x="582" y="385"/>
8282
</scene>
8383
</scenes>
8484
</document>

ChameleonFramework.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ChameleonFramework"
3-
s.version = "2.0.2.2"
3+
s.version = "2.0.3"
44
s.summary = "Color Framework for iOS (Obj-C & Swift)"
55
s.homepage = "https://github.com/ViccAlexander/Chameleon"
66
s.screenshots = "https://camo.githubusercontent.com/bde5aa6ee0e1feec044d184a735da8024c60c04c/687474703a2f2f692e696d6775722e636f6d2f427771486842342e706e67"

Pod/Classes/Objective-C/Chameleon_.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#pragma mark - Global Theming
2424

2525
/**
26-
* Set a global theme using a primary color.
26+
* Set a global theme using a primary color and the specified content style.
2727
*
2828
* @param primaryColor The primary color to theme all controllers with.
2929
* @param contentStyle The contentStyle.
@@ -36,7 +36,7 @@
3636
withContentStyle:(UIContentStyle)contentStyle;
3737

3838
/**
39-
* Set a global theme using a primary color.
39+
* Set a global theme using a primary color, secondary color, and the specified content style.
4040
*
4141
* @param primaryColor The primary color to theme all controllers with.
4242
* @param secondaryColor The secondary color to theme all controllers with.
@@ -49,7 +49,7 @@
4949
andContentStyle:(UIContentStyle)contentStyle;
5050

5151
/**
52-
* Set a global theme using a primary color.
52+
* Set a global theme using a primary color, secondary color, font name, and the specified content style.
5353
*
5454
* @param primaryColor The primary color to theme all controllers with.
5555
* @param secondaryColor The secondary color to theme all controllers with.

Pod/Classes/Objective-C/UINavigationController+Chameleon.h

+7
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@
2222
*/
2323
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle;
2424

25+
/**
26+
* Hides the hairline view at the bottom of a navigation bar. The default value is @c NO.
27+
*
28+
* @since 2.0.3
29+
*/
30+
@property (nonatomic, assign) BOOL hidesNavigationBarHairline;
31+
2532
@end

Pod/Classes/Objective-C/UINavigationController+Chameleon.m

+44-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ @interface UINavigationController ()
2626

2727
@implementation UINavigationController (Chameleon)
2828

29+
@dynamic hidesNavigationBarHairline;
30+
2931
#pragma mark - Swizzling
3032

3133
+ (void)load {
@@ -60,24 +62,35 @@ + (void)load {
6062
}
6163

6264
- (void)chameleon_viewDidLoad {
65+
6366
[self chameleon_viewDidLoad];
6467

65-
UIView *heairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];
66-
if (heairlineImageView) {
67-
heairlineImageView.hidden = YES;
68+
UIView *hairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];
69+
70+
if (hairlineImageView) {
71+
72+
if (self.hidesNavigationBarHairline) {
73+
hairlineImageView.hidden = YES;
74+
75+
} else {
76+
hairlineImageView.hidden = NO;
77+
}
6878
}
6979
}
7080

7181
- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
82+
7283
if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
7384
return (UIImageView *)view;
7485
}
86+
7587
for (UIView *subview in view.subviews) {
7688
UIImageView *imageView = [self findHairlineImageViewUnder:subview];
7789
if (imageView) {
7890
return imageView;
7991
}
8092
}
93+
8194
return nil;
8295
}
8396

@@ -107,6 +120,34 @@ - (BOOL)shouldUseLightContent {
107120
return [number boolValue];
108121
}
109122

123+
- (void)setHidesNavigationBarHairline:(BOOL)hidesNavigationBarHairline {
124+
125+
NSNumber *number = [NSNumber numberWithBool:hidesNavigationBarHairline];
126+
objc_setAssociatedObject(self, @selector(hidesNavigationBarHairline), number, OBJC_ASSOCIATION_RETAIN);
127+
128+
//Find Hairline Image
129+
UIView *hairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];
130+
131+
//Check if it exists
132+
if (hairlineImageView) {
133+
134+
//Check if we should hide it or not
135+
if (hidesNavigationBarHairline) {
136+
hairlineImageView.hidden = YES;
137+
138+
} else {
139+
hairlineImageView.hidden = NO;
140+
}
141+
}
142+
}
143+
144+
- (BOOL)hidesNavigationBarHairline {
145+
146+
NSNumber *number = objc_getAssociatedObject(self, @selector(hidesNavigationBarHairline));
147+
return [number boolValue];
148+
}
149+
150+
110151
#pragma mark - Public Methods
111152

112153
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle {
@@ -129,7 +170,6 @@ - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle {
129170
}
130171
}
131172

132-
133173
#pragma mark - Private Methods
134174

135175
- (UIStatusBarStyle)preferredStatusBarStyle {

Pod/Classes/Objective-C/UIViewController+Chameleon.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@interface UIViewController (Chameleon)
1313

1414
/**
15-
* Sets the color theme for the specified view controller.
15+
* Sets the color theme for the specified view controller using a primary color and the specified content style.
1616
*
1717
* @param primaryColor The primary color.
1818
* @param contentStyle The contentStyle.
@@ -23,7 +23,7 @@
2323
withContentStyle:(UIContentStyle)contentStyle;
2424

2525
/**
26-
* Sets the color theme for the specified view controller.
26+
* Sets the color theme for the specified view controller using a primary color, secondary color, and the specified content style.
2727
*
2828
* @param primaryColor The primary color.
2929
* @param secondaryColor The secondary color.
@@ -36,7 +36,7 @@
3636
andContentStyle:(UIContentStyle)contentStyle;
3737

3838
/**
39-
* Sets the color theme for the specified view controller.
39+
* Sets the color theme for the specified view controller using a primary color, secondary color, font name, and the specified content style.
4040
*
4141
* @param primaryColor The primary color.
4242
* @param secondaryColor The secondary color.

0 commit comments

Comments
 (0)