Latest 1.0.1
Homepage https://github.com/Liya86/LYTimerHelper
License MIT Copyright 2018
Permission is granted to…
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit

定时简易封装

  • 引用
    pod ‘LYTimerHelper’

  • 使用

    默认 1s 间隔的定时器

    //默认 1s 循环
    [[LYTimer defaultTimer] addTimerWith:@"timer_1" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"timer_1");
    }];
    
    // 循环1次
    [[LYTimer defaultTimer] addTimerForOnceWith:@"timer_once_1" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"timer_once_1");
    }];
    
    // 循环5次
    [[LYTimer defaultTimer] addTimerWith:@"timer_repeat_5" repeatNum:5 withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"timer_repeat_5 = %ld", (long)event.repeatNum);
    }];

    3s 间隔的定时器

    [[LYTimer timerWithInterval:3] addTimerForOnceWith:@"timer_3" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"timer_3");
    }];

    1桢 间隔

    [[LYTimer defaultDisplayLink] addTimerWith:@"link_1" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"link_1");
    }];
    
    [[LYTimer defaultDisplayLink] addTimerForOnceWith:@"link_once_1" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"link_once_1");
    }];
    
    [[LYTimer defaultDisplayLink] addTimerWith:@"link_repeat_5" repeatNum:5 withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"link_repeat_5 = %ld", (long)event.repeatNum);
    }];
    

    3桢 间隔

    [[LYTimer displayLinkWithFrameInterval:3] addTimerForOnceWith:@"link_3" withActionBlock:^(LYTimerEvent *event) {
        NSLog(@"link_3");
    }];

    移除

    [[LYTimer defaultTimer] removeTimerForKey:@"timer_1"];
    [[LYTimer defaultDisplayLink] removeTimerForKey:@"link_1"];

Latest podspec

{
    "name": "LYTimerHelper",
    "version": "1.0.1",
    "summary": "u5b9au65f6u7b80u6613u5c01u88c5",
    "description": "u5b9au65f6u7b80u6613u5c01u88c5 ^-^",
    "homepage": "https://github.com/Liya86/LYTimerHelper",
    "license": {
        "type": "MIT",
        "text": "                   Copyright 2018n                   Permission is granted to...n"
    },
    "authors": "Liya86",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Liya86/LYTimerHelper.git",
        "tag": "1.0.1"
    },
    "source_files": "Source/**/*.{h,m}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This