ios 繪製線條

來源:互聯網
上載者:User

標籤: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 繪製線條

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.