Chapter 19 Subclassing UITableViewCell

Chapter 19 Subclassing UITableViewCell

 

1. iOS provides a convenient suite of functions to create offscreen contexts and produce images from them. To create an offscreen image context, you use the function UIGraphicsBeginImageContextWithOptions. This function accepts a CGSize structure that specifies the width and height of the image context, a scaling factor, and whether the image should be opaque. When this function is called, a new CGContextRef is created and becomes the current context.

To draw to a CGContextRef, you use Core Graphics, just as though you were implementing a drawRect: method for a UIView subclass. To get a UIImage from the context after it has been drawn, you call the function UIGraphicsGetImageFromCurrentImageContext.

Once you have produced an image from an image context, you must clean up the context with the function UIGraphicsEndImageContext.

posted @ 2014-10-04 19:29  1oo1  阅读(116)  评论(0编辑  收藏  举报