Skip to content

Instantly share code, notes, and snippets.

@rinatkhanov
Created March 16, 2014 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rinatkhanov/9583748 to your computer and use it in GitHub Desktop.
Save rinatkhanov/9583748 to your computer and use it in GitHub Desktop.
UIView+Debug.m
//
// UIView+Debug.m
// Symbols
//
// Created by Khanov on 16/03/14.
// Copyright (c) 2014 Khanov. All rights reserved.
//
#import "UIView+Debug.h"
@implementation UIView (Debug)
-(void)enableDebugMode {
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 *randomColor = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:0.3];
self.backgroundColor = randomColor;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment