add files apis

This commit is contained in:
lianxiang
2018-08-30 18:07:16 +08:00
parent 54e936535f
commit 3efde8e0ea
68 changed files with 1254 additions and 374 deletions
+19
View File
@@ -0,0 +1,19 @@
//
// GiGaAttributedLabel.h
// GIGA
//
// Created by lianxiang on 2018/8/30.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <TTTAttributedLabel/TTTAttributedLabel.h>
#ifndef IB_DESIGNABLE
#define IB_DESIGNABLE
#endif
@class TTTAttributedLabel;
IB_DESIGNABLE @interface GiGaAttributedLabel : TTTAttributedLabel{
}
@end
+21
View File
@@ -0,0 +1,21 @@
//
// GiGaAttributedLabel.m
// GIGA
//
// Created by lianxiang on 2018/8/30.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaAttributedLabel.h"
@implementation GiGaAttributedLabel
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
+50
View File
@@ -0,0 +1,50 @@
//
// NSTimer+Convenience.h
// ISCTest
//
// Created by imac on 16/3/23.
// Copyright © 2016年 xiang. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSTimer (Convenience)
typedef void (^LXVoidBlock)(void);
/**
* 创建Timer---Block版本
*
* @param interval 每隔interval秒就回调一次callback
* @param repeats 是否重复
* @param callback 回调block
*
* @return NSTimer对象
*/
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
repeats:(BOOL)repeats
callback:(LXVoidBlock)callback;
/**
* 创建Timer---Block版本
*
* @param interval 每隔interval秒就回调一次callback
* @param count 回调多少次后自动暂停,如果count <= 0,则表示无限次,否则表示具体的次数
* @param callback 回调block
*
* @return NSTimer对象
*/
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
count:(NSInteger)count
callback:(LXVoidBlock)callback;
/**
* 开始启动定时器
*/
- (void)fireTimer;
/**
* 暂停定时器
*/
- (void)unfireTimer;
@end
+78
View File
@@ -0,0 +1,78 @@
//
// NSTimer+Convenience.m
// ISCTest
//
// Created by imac on 16/3/23.
// Copyright © 2016年 xiang. All rights reserved.
//
#import "NSTimer+Convenience.h"
@implementation NSTimer (Convenience)
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
repeats:(BOOL)repeats
callback:(LXVoidBlock)callback {
return [NSTimer scheduledTimerWithTimeInterval:interval
target:self
selector:@selector(onTimerUpdateBlock:)
userInfo:[callback copy]
repeats:repeats];
}
+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval
count:(NSInteger)count
callback:(LXVoidBlock)callback {
NSDictionary *userInfo = @{@"callback" : [callback copy],
@"count" : @(count)};
return [NSTimer scheduledTimerWithTimeInterval:interval
target:self
selector:@selector(onTimerUpdateCountBlock:)
userInfo:userInfo
repeats:YES];
}
+ (void)onTimerUpdateBlock:(NSTimer *)timer {
LXVoidBlock block = timer.userInfo;
if (block) {
block();
}
}
+ (void)onTimerUpdateCountBlock:(NSTimer *)timer {
static NSUInteger currentCount = 0;
NSDictionary *userInfo = timer.userInfo;
LXVoidBlock callback = userInfo[@"callback"];
NSNumber *count = userInfo[@"count"];
if (count.integerValue <= 0) {
if (callback) {
callback();
}
} else {
if (currentCount < count.integerValue) {
currentCount++;
if (callback) {
callback();
}
} else {
currentCount = 0;
[timer unfireTimer];
[timer invalidate];
timer = nil;
}
}
}
- (void)fireTimer {
[self setFireDate:[NSDate distantPast]];
}
- (void)unfireTimer {
[self setFireDate:[NSDate distantFuture]];
}
@end
+2 -2
View File
@@ -56,8 +56,8 @@ static char overlayKey;
-(void)resetBackgroundImage{
[self setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
//[self setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
//[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
}