title: iOS, Draw text with stroke on UIImage
body: <p>I am currently drawing text onto a UIImage which appears in an AnnotationView in an iOS Map - custom icons which appear at certain long/lat coordinates. Works well. However, I would like to draw this text with a white stroke (you might call it an outline).</p>
  
  <p>// <a href="https://stackoverflow.com/questions/12571852/draw-text-and-add-to-a-uiimage-ios-5-6">Draw text and add to a UIImage iOS 5/6</a></p>
  
  <pre><code>+ (UIImage*)drawText:(NSString*)string inImage:(UIImage*)image atPoint:(CGPoint)point {
  
      UIFont *font = [UIFont boldSystemFontOfSize:12];
      UIGraphicsBeginImageContext(image.size);
      [image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)];
  
      CGRect rect = CGRectMake(point.x, point.y, image.size.width, image.size.height);
      [[UIColor whiteColor] set];
      [string drawInRect:CGRectIntegral(rect) withFont:font];
      UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
  
      return newImage;
  
  }
  </code></pre>