Cheeky solution to the silver challenge =P


This is not the prescribed method of solving the challenge but I had fun doing it so I thought I’d share =P.

Instead of using line and point, I essentially created a NSString with a “+” sign, made the font bigger and stamped it across the front. It works even when you shake it! =D

Here’s the code:

NSString *cross = @"+";
    UIFont *crossSize = [UIFont systemFontOfSize:40];
    CGRect crossRect;
    crossRect.size = [cross sizeWithFont:crossSize];
    crossRect.origin.x = center.x - crossRect.size.width /2.0;
    crossRect.origin.y = center.y - crossRect.size.height / 2.0;
    [[UIColor greenColor] setFill];
    [cross drawInRect:crossRect withFont:crossSize];
  • the “Crosshair” does not have a shadow
  • Appears in every instance
  • and is drawn on top of the ‘you are getting sleepy’ text

Okay time to actually do it the hard way =/