forked from jamztang/JTGestureBasedTableViewDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Visual tuning for cell color, status bar
- Loading branch information
Showing
8 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
JTGestureBasedTableView/UIColor+JTGestureBasedTableViewHelper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* This file is part of the JTGestureBasedTableView package. | ||
* (c) James Tang <mystcolor@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIColor (JTGestureBasedTableViewHelper) | ||
- (UIColor *)colorWithBrightness:(CGFloat)brightness; | ||
- (UIColor *)colorWithHueOffset:(CGFloat)hueOffset; | ||
@end | ||
|
60 changes: 60 additions & 0 deletions
60
JTGestureBasedTableView/UIColor+JTGestureBasedTableViewHelper.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* This file is part of the JTGestureBasedTableView package. | ||
* (c) James Tang <mystcolor@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
#import "UIColor+JTGestureBasedTableViewHelper.h" | ||
|
||
@implementation UIColor (JTGestureBasedTableViewHelper) | ||
- (UIColor *)colorWithBrightness:(CGFloat)brightnessComponent { | ||
|
||
UIColor *newColor = nil; | ||
if ( ! newColor) { | ||
CGFloat hue, saturation, brightness, alpha; | ||
if ([self getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha]) { | ||
newColor = [UIColor colorWithHue:hue | ||
saturation:saturation | ||
brightness:brightness * brightnessComponent | ||
alpha:alpha]; | ||
} | ||
} | ||
|
||
if ( ! newColor) { | ||
CGFloat red, green, blue, alpha; | ||
if ([self getRed:&red green:&green blue:&blue alpha:&alpha]) { | ||
newColor = [UIColor colorWithRed:red*brightnessComponent | ||
green:green*brightnessComponent | ||
blue:blue*brightnessComponent | ||
alpha:alpha]; | ||
} | ||
} | ||
|
||
if ( ! newColor) { | ||
CGFloat white, alpha; | ||
if ([self getWhite:&white alpha:&alpha]) { | ||
newColor = [UIColor colorWithWhite:white * brightnessComponent alpha:alpha]; | ||
} | ||
} | ||
|
||
return newColor; | ||
} | ||
|
||
- (UIColor *)colorWithHueOffset:(CGFloat)hueOffset { | ||
UIColor *newColor = nil; | ||
if ( ! newColor) { | ||
CGFloat hue, saturation, brightness, alpha; | ||
if ([self getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha]) { | ||
// We wants the hue value to be between 0 - 1 after appending the offset | ||
CGFloat newHue = fmodf((hue + hueOffset), 1); | ||
newColor = [UIColor colorWithHue:newHue | ||
saturation:saturation | ||
brightness:brightness | ||
alpha:alpha]; | ||
} | ||
} | ||
return newColor; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters