第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

IOS中的循環(huán)進(jìn)度條

IOS中的循環(huán)進(jìn)度條

智慧大石 2019-12-12 13:04:30
我想創(chuàng)建一個圓形的進(jìn)度條,如下所示:如何使用Objective-C和Cocoa做到這一點(diǎn)?我開始做的是創(chuàng)建UIView和編輯drawRect,但是我有點(diǎn)迷茫。任何幫助將不勝感激。謝謝!
查看完整描述

3 回答

?
胡子哥哥

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超6個贊

我的魔術(shù)數(shù)字示例(以便更好地理解):


  CAShapeLayer *circle = [CAShapeLayer layer];

  circle.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(29, 29) radius:27 startAngle:-M_PI_2 endAngle:2 * M_PI - M_PI_2 clockwise:YES].CGPath;

  circle.fillColor = [UIColor clearColor].CGColor;

  circle.strokeColor = [UIColor greenColor].CGColor;

  circle.lineWidth = 4;


  CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];

  animation.duration = 10;

  animation.removedOnCompletion = NO;

  animation.fromValue = @(0);

  animation.toValue = @(1);

  animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

  [circle addAnimation:animation forKey:@"drawCircleAnimation"];


  [imageCircle.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];

  [imageCircle.layer addSublayer:circle];


查看完整回答
反對 回復(fù) 2019-12-12
?
茅侃侃

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超22個贊

對于Swift來說,


let circle = UIView(frame: CGRectMake(0,0, 100, 100))


circle.layoutIfNeeded()


let centerPoint = CGPoint (x: circle.bounds.width / 2, y: circle.bounds.width / 2)

let circleRadius : CGFloat = circle.bounds.width / 2 * 0.83


var circlePath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: CGFloat(-0.5 * M_PI), endAngle: CGFloat(1.5 * M_PI), clockwise: true    )


let progressCircle = CAShapeLayer()

progressCircle.path = circlePath.CGPath

progressCircle.strokeColor = UIColor.greenColor().CGColor

progressCircle.fillColor = UIColor.clearColor().CGColor

progressCircle.lineWidth = 1.5

progressCircle.strokeStart = 0

progressCircle.strokeEnd = 0.22


circle.layer.addSublayer(progressCircle)


self.view.addSubview(circle)


查看完整回答
反對 回復(fù) 2019-12-12
  • 3 回答
  • 0 關(guān)注
  • 780 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號