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

Commit

Permalink
Updated to 2.0.3
Browse files Browse the repository at this point in the history
* Added `HidesNavigationBarHairline` boolean, and by default it is now
set to `NO`.
* Edited Quick Look Documentation for several methods.
  • Loading branch information
vicc committed Oct 2, 2015
1 parent 88a6274 commit acec143
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 14 deletions.
6 changes: 3 additions & 3 deletions ChameleonDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
<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">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9035"/>
</dependencies>
<scenes>
<!--Title goes Here-->
Expand Down Expand Up @@ -78,7 +78,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="A2b-rc-aii" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="581" y="1045"/>
<point key="canvasLocation" x="582" y="385"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion ChameleonFramework.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ChameleonFramework"
s.version = "2.0.2.2"
s.version = "2.0.3"
s.summary = "Color Framework for iOS (Obj-C & Swift)"
s.homepage = "https://github.com/ViccAlexander/Chameleon"
s.screenshots = "https://camo.githubusercontent.com/bde5aa6ee0e1feec044d184a735da8024c60c04c/687474703a2f2f692e696d6775722e636f6d2f427771486842342e706e67"
Expand Down
6 changes: 3 additions & 3 deletions Pod/Classes/Objective-C/Chameleon_.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma mark - Global Theming

/**
* Set a global theme using a primary color.
* Set a global theme using a primary color and the specified content style.
*
* @param primaryColor The primary color to theme all controllers with.
* @param contentStyle The contentStyle.
Expand All @@ -36,7 +36,7 @@
withContentStyle:(UIContentStyle)contentStyle;

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

/**
* Set a global theme using a primary color.
* Set a global theme using a primary color, secondary color, font name, and the specified content style.
*
* @param primaryColor The primary color to theme all controllers with.
* @param secondaryColor The secondary color to theme all controllers with.
Expand Down
7 changes: 7 additions & 0 deletions Pod/Classes/Objective-C/UINavigationController+Chameleon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@
*/
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle;

/**
* Hides the hairline view at the bottom of a navigation bar. The default value is @c NO.
*
* @since 2.0.3
*/
@property (nonatomic, assign) BOOL hidesNavigationBarHairline;

@end
48 changes: 44 additions & 4 deletions Pod/Classes/Objective-C/UINavigationController+Chameleon.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ @interface UINavigationController ()

@implementation UINavigationController (Chameleon)

@dynamic hidesNavigationBarHairline;

#pragma mark - Swizzling

+ (void)load {
Expand Down Expand Up @@ -60,24 +62,35 @@ + (void)load {
}

- (void)chameleon_viewDidLoad {

[self chameleon_viewDidLoad];

UIView *heairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];
if (heairlineImageView) {
heairlineImageView.hidden = YES;
UIView *hairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];

if (hairlineImageView) {

if (self.hidesNavigationBarHairline) {
hairlineImageView.hidden = YES;

} else {
hairlineImageView.hidden = NO;
}
}
}

- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {

if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
return (UIImageView *)view;
}

for (UIView *subview in view.subviews) {
UIImageView *imageView = [self findHairlineImageViewUnder:subview];
if (imageView) {
return imageView;
}
}

return nil;
}

Expand Down Expand Up @@ -107,6 +120,34 @@ - (BOOL)shouldUseLightContent {
return [number boolValue];
}

- (void)setHidesNavigationBarHairline:(BOOL)hidesNavigationBarHairline {

NSNumber *number = [NSNumber numberWithBool:hidesNavigationBarHairline];
objc_setAssociatedObject(self, @selector(hidesNavigationBarHairline), number, OBJC_ASSOCIATION_RETAIN);

//Find Hairline Image
UIView *hairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];

//Check if it exists
if (hairlineImageView) {

//Check if we should hide it or not
if (hidesNavigationBarHairline) {
hairlineImageView.hidden = YES;

} else {
hairlineImageView.hidden = NO;
}
}
}

- (BOOL)hidesNavigationBarHairline {

NSNumber *number = objc_getAssociatedObject(self, @selector(hidesNavigationBarHairline));
return [number boolValue];
}


#pragma mark - Public Methods

- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle {
Expand All @@ -129,7 +170,6 @@ - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle {
}
}


#pragma mark - Private Methods

- (UIStatusBarStyle)preferredStatusBarStyle {
Expand Down
6 changes: 3 additions & 3 deletions Pod/Classes/Objective-C/UIViewController+Chameleon.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@interface UIViewController (Chameleon)

/**
* Sets the color theme for the specified view controller.
* Sets the color theme for the specified view controller using a primary color and the specified content style.
*
* @param primaryColor The primary color.
* @param contentStyle The contentStyle.
Expand All @@ -23,7 +23,7 @@
withContentStyle:(UIContentStyle)contentStyle;

/**
* Sets the color theme for the specified view controller.
* Sets the color theme for the specified view controller using a primary color, secondary color, and the specified content style.
*
* @param primaryColor The primary color.
* @param secondaryColor The secondary color.
Expand All @@ -36,7 +36,7 @@
andContentStyle:(UIContentStyle)contentStyle;

/**
* Sets the color theme for the specified view controller.
* Sets the color theme for the specified view controller using a primary color, secondary color, font name, and the specified content style.
*
* @param primaryColor The primary color.
* @param secondaryColor The secondary color.
Expand Down

0 comments on commit acec143

Please sign in to comment.