ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码
当前位置:首页 >> 网络编程 >> IOS开发 >> 圆圈loader的动画

圆圈loader的动画

来源:网络整理     时间:2015-01-07     关键词:

本篇文章主要介绍了"圆圈loader的动画",主要涉及到方面的内容,对于IOS开发感兴趣的同学可以参考一下: 圆圈loader的动画by 伍雪颖github代码- (void)awakeFromNib { [selfsetup]; [selfstartAni...

圆圈loader的动画

by 伍雪颖


github代码

- (void)awakeFromNib {

    [selfsetup];
    [
selfstartAnimation];
}
- (
void)setup {
   
self.backgroundColor= [UIColorclearColor];
   
self.backgroundLayer= [CAShapeLayerlayer];
   
_backgroundLayer.strokeColor= [UIColorcolorWithRed:0.129green:0.455blue:0.627alpha:1.0].CGColor;
   
_backgroundLayer.fillColor=self.backgroundColor.CGColor;
   
_backgroundLayer.lineCap=kCALineCapRound;
   
_backgroundLayer.lineWidth=1;
    [
self.layeraddSublayer:_backgroundLayer];
}
- (
void)startAnimation {
   
CGFloatstartAngle = - ((float)M_PI/2);
   
CGFloatendAngle = (1.8f* (float)M_PI) + startAngle;
   
   
UIBezierPath*processBackgroundPath = [UIBezierPathbezierPath];
    processBackgroundPath.
lineWidth=1;
    [processBackgroundPath
addArcWithCenter:CGPointMake(self.bounds.size.width/2,self.bounds.size.height/2)
                                    
radius:(self.bounds.size.width-1)/2
                                
startAngle:startAngle
                                  
endAngle:endAngle
                                 
clockwise:YES];
   
_backgroundLayer.path= processBackgroundPath.CGPath;
   
   
CABasicAnimation*rotationAnimation = [CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.
toValue= [NSNumbernumberWithFloat:M_PI*2.0];
    rotationAnimation.
duration=1;
    rotationAnimation.
cumulative=YES;
    rotationAnimation.
repeatCount=HUGE_VALF;
    [
_backgroundLayeraddAnimation:rotationAnimationforKey:@"rotationAnimation"];
}
- (
void)drawRect:(CGRect)rect {
   
_backgroundLayer.frame=self.bounds;

}


以上就介绍了圆圈loader的动画,包括了方面的内容,希望对IOS开发有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_104427.html

相关图片

相关文章