Ios 如何绘制wifi信号脉冲并设置其动画

Ios 如何绘制wifi信号脉冲并设置其动画,ios,objective-c,core-animation,uiviewanimation,Ios,Objective C,Core Animation,Uiviewanimation,我想画一个wifi信号脉冲,并想在启动屏幕上用它来制作动画。我用这个密码试过了。信号显示在向下的文字中,但我需要显示在向上的文字中。从ti增加点开始[如我们的手机wifi信号] - (void)viewDidLoad { [super viewDidLoad]; [self addWavesToView]; [self addAnimationsToLayers]; } - (void)addWavesToView { CGRect rect = CGRectMake(0.0f,

我想画一个wifi信号脉冲,并想在启动屏幕上用它来制作动画。我用这个密码试过了。信号显示在向下的文字中,但我需要显示在向上的文字中。从ti增加点开始[如我们的手机wifi信号]

 - (void)viewDidLoad
{
[super viewDidLoad];

[self addWavesToView];
[self addAnimationsToLayers];
}

- (void)addWavesToView
 {
    CGRect rect = CGRectMake(0.0f, 0.0f, 300.0f, 300.0f);
    UIBezierPath *circlePath = [UIBezierPath 
    bezierPathWithOvalInRect:rect];

for (NSInteger i = 0; i < 10; ++i) {
    CAShapeLayer *waveLayer = [CAShapeLayer layer];
    waveLayer.bounds = rect;
    waveLayer.position = CGPointMake(100, 100);
    waveLayer.strokeColor = [[UIColor lightGrayColor] CGColor];
    waveLayer.fillColor = [[UIColor clearColor] CGColor];
    waveLayer.lineWidth = 5.0f;
    waveLayer.path = circlePath.CGPath;


    waveLayer.transform = CATransform3DMakeTranslation(0.0f, i*25, 0.0f);
    waveLayer.strokeStart = 0.25- ((i+1) * 0.01f);
    waveLayer.strokeEnd = 0.25+((i+1) * 0.01f);

    [self.view.layer addSublayer:waveLayer];
}
 }

 - (void)addAnimationsToLayers
 {
NSInteger timeOffset = 10;
for (CALayer *layer in self.view.layer.sublayers) {
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeColor"];
    animation.duration = 10.0f;

    // Stagger the animations so they don't begin until the
    // desired time in each
    animation.timeOffset = timeOffset--;
    animation.toValue = (id)[[UIColor lightGrayColor] CGColor];
    animation.fromValue = (id)[[UIColor darkGrayColor] CGColor];

    // Repeat forever
    animation.repeatCount = HUGE_VALF;

    // Run it at 10x. You can adjust this to taste.
    animation.speed = 10;

    // Add to the layer to start the animation
    [layer addAnimation:animation forKey:@"strokeColor"];
}
-(void)viewDidLoad
{
[超级视图下载];
[自添加WaveStoView];
[自添加动画ToLayers];
}
-(void)addWavesToView
{
CGRect rect=CGRectMake(0.0f、0.0f、300.0f、300.0f);
UIBezierPath*circlePath=[UIBezierPath
bezierPathWithOvalInRect:rect];
对于(NSInteger i=0;i<10;++i){
CAShapeLayer*波层=[CAShapeLayer层];
waveLayer.bounds=rect;
waveLayer.position=CGPointMake(100100);
waveLayer.strokeColor=[[UIColor lightGrayColor]CGColor];
waveLayer.fillColor=[[UIColor clearColor]CGColor];
waveLayer.lineWidth=5.0f;
waveLayer.path=circlePath.CGPath;
waveLayer.transform=CATTransformerM3dMakeTransformation(0.0f,i*25,0.0f);
waveLayer.strokeStart=0.25-((i+1)*0.01f);
波层频移=0.25+((i+1)*0.01f);
[self.view.layer addSublayer:waveLayer];
}
}
-(无效)添加动画到图层
{
NSInteger时间偏移=10;
for(self.view.layer.sublayers中的CALayer*层){
CABasicAnimation*动画=[CABasicAnimation animationWithKeyPath:@“strokeColor”];
animation.duration=10.0f;
//错开动画,使其在
//在每种情况下所需的时间
animation.timeOffset=时间偏移--;
animation.toValue=(id)[[UIColor lightGrayColor]CGColor];
animation.fromValue=(id)[[UIColor darkGrayColor]CGColor];
//永远重复
animation.repeatCount=巨大的值;
//以10倍的速度运行。你可以根据口味调整。
动画速度=10;
//添加到层以开始动画
[层添加动画:动画分叉:@“strokeColor”];
}
“向上显示文字”,这将花费更多时间,因此我们可以通过
viewDidLoad()函数中的此代码将基本视图旋转180度

    CGFloat degreesOfRotation = 180.0;
   self.view.transform = CGAffineTransformRotate(self.view.transform,
                                         degreesOfRotation * M_PI/180.0);
“以文字显示”,这将花费更多的时间,因此我们可以通过
viewdiload()函数中的此代码将基本视图旋转180度

    CGFloat degreesOfRotation = 180.0;
   self.view.transform = CGAffineTransformRotate(self.view.transform,
                                         degreesOfRotation * M_PI/180.0);

@mhillsman有没有办法将其旋转到upside@mhillsman有没有办法把它转过来谢谢:)工作正常谢谢:)工作正常