|
@@ -9,14 +9,24 @@
|
|
|
#import "FLEXColorExplorerViewController.h"
|
|
#import "FLEXColorExplorerViewController.h"
|
|
|
|
|
|
|
|
@interface FLEXColorExplorerViewController ()
|
|
@interface FLEXColorExplorerViewController ()
|
|
|
-
|
|
|
|
|
|
|
+@property (nonatomic, readonly) UIColor *colorObject;
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation FLEXColorExplorerViewController
|
|
@implementation FLEXColorExplorerViewController
|
|
|
|
|
|
|
|
-- (BOOL)shouldShowDescription
|
|
|
|
|
|
|
+- (UIColor *)colorObject
|
|
|
{
|
|
{
|
|
|
- return NO;
|
|
|
|
|
|
|
+ return (UIColor *)self.object;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (NSString *)displayedObjectDescription
|
|
|
|
|
+{
|
|
|
|
|
+ CGFloat h, s, l;
|
|
|
|
|
+ CGFloat r, g, b, a;
|
|
|
|
|
+ [self.colorObject getRed:&r green:&g blue:&b alpha:&a];
|
|
|
|
|
+ [self.colorObject getHue:&h saturation:&s brightness:&l alpha:nil];
|
|
|
|
|
+
|
|
|
|
|
+ return [NSString stringWithFormat:@"HSL: (%.3f, %.3f, %.3f)\nRGB: (%.3f, %.3f, %.3f)\nAlpha: %.3f", h, s, l, r, g, b, a];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)customSectionTitle
|
|
- (NSString *)customSectionTitle
|
|
@@ -31,10 +41,18 @@
|
|
|
|
|
|
|
|
- (UIView *)customViewForRowCookie:(id)rowCookie
|
|
- (UIView *)customViewForRowCookie:(id)rowCookie
|
|
|
{
|
|
{
|
|
|
- CGFloat width = [UIScreen mainScreen].bounds.size.width;
|
|
|
|
|
- UIView *square = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 44)];
|
|
|
|
|
- square.backgroundColor = (UIColor *)self.object;
|
|
|
|
|
- return square;
|
|
|
|
|
|
|
+ if ([rowCookie isKindOfClass:[NSNumber class]]) {
|
|
|
|
|
+ CGFloat width = [UIScreen mainScreen].bounds.size.width;
|
|
|
|
|
+ switch ([rowCookie integerValue]) {
|
|
|
|
|
+ case 0: {
|
|
|
|
|
+ UIView *square = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 44)];
|
|
|
|
|
+ square.backgroundColor = (UIColor *)self.object;
|
|
|
|
|
+ return square;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return [super customViewForRowCookie:rowCookie];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)customSectionCanDrillIntoRowWithCookie:(id)rowCookie
|
|
- (BOOL)customSectionCanDrillIntoRowWithCookie:(id)rowCookie
|