iOS版类似猎豹垃圾清理,非常棒的产品原型及学习源码

概述

本文介绍一个仿iOS猎豹垃圾清理的demo App。它实现了以下主要功能:
获取设备已安装App列表已经App信息
扫描动画的实现
获取已用存储和可用存储
垃圾清理

源码下载

下面讲解各个主要功能的实现。

获取设备已安装App列表
扫描动画的实现

这里主要有两个动画。
利用UIScrollView, 实现每个App自动滚动。
Animation动画, 中间扫描线的往返运动。

- (void)addScanLineAnimation
{
    ScanLineIV *mySL = [[ScanLineIV alloc]initWithFrame:CGRectMake((self.view.frame.size.width - 156)/2, 300, 156, 90)];

    [self.view addSubview:mySL];


    /* 向左移动 */
    CABasicAnimation *animationLeft = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];

    // 动画选项的设定
    animationLeft.duration = 0.5f; // 持续时间
    animationLeft.beginTime = 0.0f;
    animationLeft.autoreverses = YES; // 结束后执行逆动画
    // 动画先加速后减速
    animationLeft.timingFunction =
    [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];

    // 终了帧
    animationLeft.toValue = [NSNumber numberWithFloat:-40];;



    /* 向右移动 */
    CABasicAnimation *animationRight = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];

    // 动画选项的设定
    animationRight.duration = 0.5f; // 持续时间
    animationRight.beginTime = 1.0f;
    animationRight.autoreverses = YES; // 结束后执行逆动画
    // 动画先加速后减速
    animationRight.timingFunction =
    [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];

    // 终了帧
    animationRight.toValue = [NSNumber numberWithFloat:40];;



    /* 动画组 */
    CAAnimationGroup *group = [CAAnimationGroup animation];
    group.delegate = self;
    group.duration = 2.0;
    group.repeatCount = 15;


    // 动画结束后不变回初始状态
    group.removedOnCompletion = NO;
    group.fillMode = kCAFillModeForwards;

    // 添加动画
    group.animations = [NSArray arrayWithObjects:animationLeft, animationRight, nil];
    [mySL.layer addAnimation:group forKey:@"moveLeft-moveRight-layer"];

}

源码下载

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值