UIGraphicsGetCurrentContext

CGContextRef context = UIGraphicsGetCurrentContext(); 设置绘图的上下文,

函数UIGraphicsGetCurrentContext一般在UIView的drawRect里调用。

 

 

- (void) drawRect:(CGRect)rect
{
    CGContextRef    context = UIGraphicsGetCurrentContext();
    CGRect          myFrame = self.bounds;
    CGContextSetLineWidth(context, 2.0);
    CGRectInset(myFrame, 5, 5);
    [[UIColor redColor] setStroke];
    [[UIColor blueColor] setFill];
    UIRectFrame(myFrame);
}

 

 

Quart 2D  CGContextRef :  http://blog.sina.com.cn/s/blog_7ff0f30f01011hk9.html 

你可能感兴趣的:(graphics)