当前位置:首页 > Windows程序 > 正文

Drawing a circle

2021-03-29 Windows程序

- (void)drawRect:(CGRect)rect {

CGFloat lineWidth = 2;
CGRect borderRect = CGRectMake(self.frame.size.width/2, self.frame.size.height - 20, 10.0, 10.0);
borderRect = CGRectInset(borderRect, lineWidth * 0.5, lineWidth * 0.5);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 85.0/255.0, 143.0/255.0, 220.0/255.0, 1.0);
CGContextSetRGBFillColor(context, 5.0/255.0, 43.0/255.0, 20.0/255.0, 1.0);
CGContextSetLineWidth(context, 2.0);
CGContextFillEllipseInRect (context, borderRect);
CGContextStrokeEllipseInRect(context, borderRect);
CGContextFillPath(context);
}

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/69798.html