工具类:快速创建单例

#import "CZTool.h"
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    NSLog(@"%@",[CZTool shareTool]);
    NSLog(@"%@",[[CZTool alloc]init]);
    NSLog(@"%@",[[CZTool alloc]init]);

}

@end
#import <Foundation/Foundation.h>
#import "CZSingle.h"
@interface CZTool : NSObject
CZSingleInterface(Tool)
@end




#import "CZTool.h"

@implementation CZTool

CZSingleImplementation(Tool)
@end

创建头文件CZSingle.h



// 两个##拼接字符串 把传过来的字符串拼接到##后面去
#define CZSingleInterface(name) +(instancetype)share##name;
// 反斜杠用来宏定义换行拼接
#define CZSingleImplementation(name) + (instancetype)share##name {\
return [[self alloc]init];\
}\
+ (instancetype)allocWithZone:(struct _NSZone *)zone {\
    static dispatch_once_t onceToken;\
    static id instance;\
    dispatch_once(&onceToken, ^{\
        instance = [super allocWithZone:zone];\
    });\
    return instance;\
}
AnimationUtils 动画工具类 AppUtils APP相关信息工具类 AssetDatabaseOpenHelper 目录资源获取 Base64 加密 BitmapUtil 获取Bitmap和对Bitmap的操作 ChannelUtil 获取市场号 Colors 颜色工具类 包括常用的色值 DES DES加密解密 DataCleanManager 本应用数据清除管理器 DatabaseExportUtils 应用数据库导出工具类 DateUtil 日期操作工具类 DbHelper 数据库帮助 DensityUtil 屏幕信息获取数值的转换 DeviceStatusUtils 手机状态工具类 主要包括网络、蓝牙、屏幕亮度、飞行模式、音量等 DigestUtils DigestUtils FileUtils 文件操作 HanziToPinyin 拼音汉字处理 IOUtils IOUtils MD5 MD5 MiscUtils 设备信息的获取 NetWorkUtils 网络状态 PhoneUtil 手机组件调用工具类 PreferencesUtils sp工具类 RandomUtils 随机数工具类 RecorderControl 录音工具类 SerializeUtils Serialize ShellUtils shell指令 ShortCutUtils 创建删除快捷图标 SingletonUtils 单例工具 SizeUtils SizeUtils SqliteUtils SqliteUtils StreamUtils 流转换成字符串 StringUtils String SystemUtils 线程池工具类 TimeUtils TimeUtils ToastUtils ToastUtils TransitionTime 用来计算显示的时间是多久之前 ViewAnimationUtils 视图动画工具箱,提供简单的控制视图的动画的工具方法 ViewUtils view控制 WiFiUtil WiFiUtil WindowUtils 窗口工具箱 ZipUtil 实现的Zip工具 BadgeUtil 设置Badge LogUtil LogUti工具类 ArrayUtils 数组工具类,提供一些有关数组的便捷方法 ByteUtils 字节工具类,提供一些有关字节的便捷方法 CheckAdapter 选择适配器 CheckingUtils 提供常用数据验证的工具类,不符合的话就抛异常 Countdown 倒计时器 DialogUtils 对话框工具箱 DoubleClickExitDetector 双击退出识别器 ImageProcessor 图片处理器 InputMethodUtils 软键盘工具类 LoopTimer 循环定时器 NestedGridView 嵌套使用的GridView NestedListView 嵌套使用的ListView OSUtils Android系统工具箱 OtherUtils 主要是给字符串添加html ReflectUtils 反射工具类,提供一些Java基本的反射功能 RegexUtils 正则表达式工具类,提供一些常用的正则表达式 SDCardUtils SD卡工具箱 Symbols 常用符号 WebViewManager WebView管理器,提供常用设置 原地址:https://github.com/l123456789jy/Lazy
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值