Skip to content

Instantly share code, notes, and snippets.

View vanessahernandez's full-sized avatar

Vanessa Hernandez vanessahernandez

  • University of Houston-Downtown
  • Houston,Texas
View GitHub Profile
@swissmanu
swissmanu / gist:4284339
Created December 14, 2012 10:27
Draws a smiley face under iOS. Pass a mood value ranging from 0 to 1 for making it happy (or sad :( )
/**
* Draws a smiley inside the given rectangle. The mood value (0...1) is used
* to make the smiley happy or sad.
*
* @param rect Rectangle to draw the smiley into
* @param mood Happy (= 1) or sad (= 0) or anything in between
*/
-(void)drawSmileyInRect:(CGRect)rect withMood:(float)mood {
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);