欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS點(diǎn)擊文字按鈕變轉(zhuǎn)圈加載效果

 更新時(shí)間:2016年05月20日 15:47:19   作者:車德平  
這篇文章主要為大家詳細(xì)介紹了iOS點(diǎn)擊文字按鈕變轉(zhuǎn)圈加載效果的相關(guān)資料,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iOS點(diǎn)擊文字按鈕變轉(zhuǎn)圈加載效果的相關(guān)代碼,供大家參考,具體內(nèi)容如下

實(shí)現(xiàn)效果:

實(shí)現(xiàn)代碼:

// 畫弧線
- (void)drawHalfCircle {
  loadingLayer = [self drawCircle];
   
  // 這個(gè)是用于指定畫筆的開始與結(jié)束點(diǎn)
  loadingLayer.strokeStart = 0.0;
  loadingLayer.strokeEnd = 0.75;
}
 
- (CAShapeLayer *)drawCircle {
  CGRect frame = CGRectMake(0, 0, self.frame.size.height, self.frame.size.height);
  CAShapeLayer *circleLayer = [CAShapeLayer layer];
  // 指定frame,只是為了設(shè)置寬度和高度
  circleLayer.frame = frame;
  // 設(shè)置居中顯示
  circleLayer.position = CGPointMake(self.frame.size.height/2, self.frame.size.height/2);
  // 設(shè)置填充顏色
  circleLayer.fillColor = [UIColor clearColor].CGColor;
  // 設(shè)置線寬
  circleLayer.lineWidth = 1;
  // 設(shè)置線的顏色
  circleLayer.strokeColor = kSelfborderColor.CGColor;
  // 使用UIBezierPath創(chuàng)建路徑
  UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:frame];
  // 設(shè)置CAShapeLayer與UIBezierPath關(guān)聯(lián)
  circleLayer.path = circlePath.CGPath;
  // 將CAShaperLayer放到某個(gè)層上顯示
  [self.layer addSublayer:circleLayer];
  return circleLayer;
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論