首页 > 代码库 > 作图flowerView
作图flowerView
作图flowerView
by 伍雪颖
- (void)drawRect:(CGRect)rect{ CGSize size = self.bounds.size; CGFloat margin = 10; CGFloat radius = rintf(MIN(size.height - margin,size.width - margin)/4); CGFloat xOffset,yOffset; CGFloat offset = rintf((size.height - size.width)/2); if (offset > 0) { xOffset = rint(margin/2); yOffset = offset; }else { xOffset = -offset; yOffset = rint(margin/2); } [[UIColor redColor] setFill]; UIBezierPath *path = [UIBezierPath bezierPath]; [path addArcWithCenter:CGPointMake(radius*2+xOffset, radius+yOffset) radius:radius startAngle:-M_PI endAngle:0 clockwise:YES]; [path addArcWithCenter:CGPointMake(radius*3+xOffset, radius*2+yOffset) radius:radius startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES]; [path addArcWithCenter:CGPointMake(radius*2+xOffset, radius*3+yOffset) radius:radius startAngle:0 endAngle:M_PI clockwise:YES]; [path addArcWithCenter:CGPointMake(radius+xOffset, radius*2+yOffset) radius:radius startAngle:M_PI_2 endAngle:-M_PI_2 clockwise:YES]; [path closePath]; [path fill]; }
作图flowerView
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。