CGContext 基本使用

- (void)drawRect:(CGRect)rect {

    // Drawing code

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);

    CGContextFillRect(context, rect);

    

    CGContextSetRGBFillColor(context, 0.7, 0.7, 0.7, 0.9); // 填充顏色

    CGContextFillRect(context, CGRectMake(10, 10, 80, 1)); // 填充的frame

    

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章