overrIDe func drawRect(rect: CGRect) {var path = UIBezIErPath(ovalInRect: rect)fillcolor.setFill()path.fill()//set up the wIDth and height variables//for the horizontal strokelet plusHeight:CGfloat = 300.0let plusWIDth:CGfloat = 450.0//create the pathvar plusPath = UIBezIErPath()//set the path's line wIDth to the height of the strokeplusPath.linewidth = plusHeight//move the initial point of the path//to the start of the horizontal strokeplusPath.movetoPoint(CGPoint( x:self.bounds.wIDth/2 - plusWIDth/2 + 0.5,y:self.bounds.height/2 + 0.5))//add a point to the path at the end of the strokeplusPath.addlinetoPoint(CGPoint( x:self.bounds.wIDth/2 + plusWIDth/2 + 0.5,y:self.bounds.height/2 + 0.5))}根据需要更改半径和fillcolor. 总结
以上是内存溢出为你收集整理的swift – 如何用CALayer创建一个圈子?全部内容,希望文章能够帮你解决swift – 如何用CALayer创建一个圈子?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)