相关疑难解决方法(0)

动画绘制圆圈

我正在寻找一种动画绘制圆圈的方法.我已经能够创建圆圈,但它将所有这些组合在一起.

这是我的CircleView班级:

import UIKit

class CircleView: UIView {
  override init(frame: CGRect) {
    super.init(frame: frame)
    self.backgroundColor = UIColor.clearColor()
  }

  required init(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }


  override func drawRect(rect: CGRect) {
    // Get the Graphics Context
    var context = UIGraphicsGetCurrentContext();

    // Set the circle outerline-width
    CGContextSetLineWidth(context, 5.0);

    // Set the circle outerline-colour
    UIColor.redColor().set()

    // Create Circle
    CGContextAddArc(context, (frame.size.width)/2, frame.size.height/2, (frame.size.width - 10)/2, 0.0, CGFloat(M_PI * 2.0), 1)

    // Draw
    CGContextStrokePath(context);
  }
}
Run Code Online (Sandbox Code Playgroud)

以下是我如何将其添加到视图控制器中的视图层次结构中:

func addCircleView() …
Run Code Online (Sandbox Code Playgroud)

geometry progress drawrect uiviewanimation swift

98
推荐指数
5
解决办法
6万
查看次数

Apple为什么要为UIBezierPath翻转他们的单位圈?

在此输入图像描述

左侧的图像是典型的单位圆圈的样子.右边的那个来自文档.我还没有看到更深入的解释为什么它在网上被翻转.为什么会这样?

trigonometry core-graphics ios uibezierpath

7
推荐指数
2
解决办法
539
查看次数