#pragma mark----------
1鹏氧、畫線
*步驟
(1)CGContextRef上下文(相當(dāng)于畫板)
(2)畫圖的內(nèi)容->設(shè)置畫圖的內(nèi)容
(3)把內(nèi)容添加到上下文
(4)把內(nèi)容畫到上下文(畫板)上
#pragma mark----------
2、常用方法介紹
(1)CGContextRef上下文
(2)路徑
《1》UIBezierPath貝塞爾路徑-通過點繪制
《2》CGMutablePathRef通過點繪制路徑
《3》注意:必須設(shè)置起始點CGContextMoveToPoint(...)
(3)畫形狀
《1》矩形CGContextAddRect(, );
《2》曲線CGContextAddCurveToPoint(, )
《3》圓形CGContextAddEllipseInRect(, )
(3.1)CGContextSetLineWidth設(shè)置筆畫寬度
(3.2)set設(shè)置筆畫顏色及其區(qū)域范圍顏色
(3.3)setFill設(shè)置畫線區(qū)域范圍填充顏色
(3.4)setStroke設(shè)置筆畫的顏色
(3.5)CGPathDrawingMode設(shè)置畫筆填充樣式
《1》kCGPathFill只填充
《2》kCGPathStroke畫筆顏色
《3》kCGPathFillStroke既填充又有畫筆顏色
(4)截圖
《1》UIGraphicsBeginImageContext開始獲得圖片上下文
《2》UIGraphicsBeginImageContextWithOptions開始截圖
《3》UIGraphicsGetImageFromCurrentImageContext()獲得當(dāng)前圖片的上下文
《4》UIGraphicsEndImageContext()關(guān)閉圖片上下文
(5)CGContextStrokePath把路徑繪制到上下文的方法
(6)直接把路徑繪制到界面stroke