# Challenge- My Solution

#1
``````#import "HypnosisView.h"
#define ARC4RANDOM_MAX      0x100000000

@implementation HypnosisView

- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}

return self;
}

-(void) drawRect:(CGRect)rect
{
// What recangle am I filling
CGRect bounds = [self bounds];

// Where is the center
CGPoint center;
center.x = bounds.origin.x + bounds.size.width / 2;
center.y = bounds.origin.y + bounds.size.height / 2;

// From the center how far out to a corner?
float maxRadius = hypotf(bounds.size.width, bounds.size.height) / 2.0;

// Get the content being drawn upon
CGContextRef context = UIGraphicsGetCurrentContext();

// All lines will be drawn 10 points wide
CGContextSetLineWidth(context, 10);

// Draw concentric circles from the outside in with assorted colors

// Set the consecutive colors using colorWithRed:green:blue:alpha: method. For each argument I used a random-number generator for a float between 0 and 1.
float red =  ((double)arc4random() / ARC4RANDOM_MAX);
float green =  ((double)arc4random() / ARC4RANDOM_MAX);
float blue =  ((double)arc4random() / ARC4RANDOM_MAX);
float alpha =  ((double)arc4random() / ARC4RANDOM_MAX);

[[ UIColor colorWithRed:red green:green blue:blue alpha:alpha] setStroke];

CGContextStrokePath(context);

}

// Create a string
NSString *text = @"You are getting sleepy.";

// Get a font to draw iti n
UIFont *font = [UIFont boldSystemFontOfSize:28];

// Where am I going to draw it?
CGRect textRect;
textRect.size = [text sizeWithFont:font];
textRect.origin.x = center.x - textRect.size.width / 2.0;
textRect.origin.y = center.y - textRect.size.height / 2.0;

// Set the fill color of the current context to black
[[UIColor blackColor] setFill];

// Set the shadow to be offset 4 points right, 3 points down,
// dark gray and with a blur radius of 2 points.
CGSize offset = CGSizeMake(4, 3);
CGColorRef color = [[ UIColor darkGrayColor] CGColor];