Created
May 21, 2013 22:11
-
-
Save kdbdallas/5623696 to your computer and use it in GitHub Desktop.
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
- (void)debugSubview | |
{ | |
[self colorSubviewsForDebugParentView:self]; | |
} | |
- (void)colorSubviewsForDebugParentView:(UIView*)view | |
{ | |
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 | |
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:0.25]; | |
view.backgroundColor = color; | |
for (UIView *child in view.subviews){ | |
[self colorSubviewsForDebugParentView:child]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment