標籤:style blog io ar color os sp on div
//添加被塞爾曲線 CGContextMoveToPoint(cgContext, 150, 100); //移動到某一個點 CGContextAddCurveToPoint(cgContext, 150, 100, 100, 100, 100, 150);//繪製被塞爾曲線,點伴隨移動,這三個參數呢,每2個為一個參數 1.point(150,100)表示開始點 2.point(100,100)表示為控制點 3.point(100,150)表示為終止點 //綜上:就是繪製一條曲線的切線相交處為控制點 CGContextAddCurveToPoint(cgContext, 100, 150, 100, 200, 150, 200);// CGContextAddCurveToPoint(cgContext, 150, 200, 200, 200, 200, 150);// CGContextAddCurveToPoint(cgContext, 200, 150, 200, 100, 150, 100);// [[UIColor redColor] setFill];//填充顏色 CGContextDrawPath(cgContext, kCGPathStroke);//畫筆畫上 // CGContextAddLineToPoint(cgContext, 50, 50);
CGContextAddLineToPoint(cgContext, 200, 30);//添加一條直線
//添加一個矩形CGContextAddRect(cgContext, CGRectMake(100, 100, 100, 100));
//添加弧度CGContextAddArc(cgContext, 100, 100, 50, 3.14/ 2, 270* 3.14/ 180, 1);//1.原點(100,100)//2.半徑 50//3.開始弧度 3.14/ 2 ,3.14就是圓周率//4.結束弧度270* 3.14/ 180//5.逆時針為1,0為順時針//---------- 解釋一下圓的弧度,弧度是按照順時針來計算弧度的,那麼開始弧度和結束弧度就確定了,弧度確定了那麼按照順逆時針來畫就比較簡單了
CGContextClosePath(cgContext);//封閉曲線
CGContextAddEllipseInRect(cgContext, CGRectMake(100, 100, 200, 100));//在一個矩形裡面內切一個橢圓其實是比較簡單的
ios 繪製線條