zoukankan      html  css  js  c++  java
  • IOS开发--动画篇-->计时定时器

    计时定时器

    设计计时定时器的步骤:

    1,创建可变数组,存放 0~100 的数字

    2,用for循环创建 0~100 的数字,并将其放入可变数组中

    3,创建定时器:创建定时器: 参数1:设置时间间隔参数2目标参数3定时器绑定的方法;参数4:补充信息一般为空;参数5:是否重复

    _timer = [NSTimerscheduledTimerWithTimeInterval:0.1target:self selector:@selector(outPut) userInfo:nilrepeats:YES];

    4,计时器停止方法:if语句判断定时器是否为空  

    if (_timer != nil)

    5,读取数据方法:创建静态变量,利用索引读取数据 

        static int count =0;

        NSString * str =[_array objectAtIndex:count];

        NSLog(@"-----%@",str);

      count ++;

     6,防止数组越界

       if (count>99) {

            count=0;

        }

     7,定时器销毁

     [_timer invalidate];

  • 相关阅读:
    webgl-hdr
    color-balance-of-photoshop-using-opencv
    ssr
    hello girl
    牛人收集的162个JavaScript学习教程pdf资源
    What is the order of postprocessing effects?
    glslsandbox
    Geeks3D’s GLSL Shader Library
    face swap
    Leetcode 115.不同的子序列
  • 原文地址:https://www.cnblogs.com/gegeboke/p/4336178.html
Copyright © 2011-2022 走看看