Simple Concentric circle effect

Source: Internet
Author: User

1 #import "BNRHypnosisView.h"2 3 @implementationBnrhypnosisview4-(Instancetype) initWithFrame: (CGRect) Frame5 {6Self =[Super Initwithframe:frame];7     if(self)8     {9Self.backgroundcolor =[Uicolor Clearcolor];Ten     } One     returnSelf ; A } -- (void) DrawRect: (cgrect) Rect - { theCGRect bounds =self.bounds; -      -     //According to Bounds Computing center point - Cgpoint Center; +center.x = bounds.origin.x + bounds.size.width/2.0; -CENTER.Y = bounds.origin.y + bounds.size.height/2.0; +      A     //calculates the radius of a circle based on the lesser values of the wide chart and high schools at //Float radius = (MIN (bounds.size.width, Bounds.size.height))/2.0; -      -     //make the outermost circle a circumscribed circle of the view -     floatMaxradius = Hypot (bounds.size.width, bounds.size.height)/2.0; -      -     //This object is used to draw lines or curves, which make up various shapes.  inUibezierpath *path =[[Uibezierpath alloc]init]; -     //center point, radius value is radius, defines a path from 0 to M_pi *2.0 radians (full circle) to //[Path Addarcwithcenter:center + //Radius:radius - //startangle:0.0 the //ENDANGLE:M_PI * 2.0 * //Clockwise:yes]; $     Panax Notoginseng      for(floatCurrentradius = Maxradius; Currentradius >0; Currentradius-= -) -     { the      //The original concentric circle produces a handwriting that appears when it is drawn and needs to be removed +[Path moveToPoint: (Cgpoint) {center.x +currentradius,center.y}]; A [Path Addarcwithcenter:center the Radius:currentradius +StartAngle:0.0 -endangle:m_pi*2.0 $ Clockwise:yes]; $     } -      -     //set the line width to 10 points thePath.linewidth =Ten; -     Wuyi     //set paint color to light gray the [[Uicolor Redcolor] setstroke]; -      Wu [path stroke]; -}

Simple Concentric circle effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.