123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- //
- // ZYCTool.h
- // ttt
- //
- // Created by 张毅成 on 2018/5/14.
- // Copyright © 2018年 张毅成. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
- //屏幕宽度比
- #define WIDTH_SCALE [UIScreen mainScreen].bounds.size.width / 375
- //屏幕高度比
- #define HEIGHT_SCALE [UIScreen mainScreen].bounds.size.height / 667
- #define kIsHaveBang [ZYCTool isHaveBang]//判断是否是刘海屏系列
- //高适配
- #define Height_SCALE(a) a*HEIGHT_SCALE
- //宽适配
- #define Width_SCALE(a) a*WIDTH_SCALE
- @interface ZYCTool : NSObject
- typedef void (^NotAvailable)(void);
- typedef void (^Available)(void);
- typedef void (^returnCancel)(void);
- typedef void (^returnNotarize)(void);
- typedef void (^returnNotarizeWithIdx)(NSInteger idx);
- @property (strong, nonatomic) UIAlertController *alertController;
- @property (copy, nonatomic) returnNotarize returnNotarize;
- @property (copy, nonatomic) returnCancel returnCancel;
- @property (copy, nonatomic) returnNotarizeWithIdx returnNotarizeWithIdx;
- /**
- 弹出alert 配两个button
- @param title alert的标题
- @param message alert的详细信息
- @param viewController 要弹出alert的控制器
- @param notarizeButtonTitle 确认按钮的title传nil的话显示@"确认"
- @param cancelButtonTitle 取消按钮的title传nil的话显示@"取消"
- @param notarize 点击确认的回调
- @param cancel 点击取消的回调
- */
- + (void)alertControllerTwoButtonWithTitle:(NSString *)title message:(NSString *)message target:(UIViewController *)viewController notarizeButtonTitle:(NSString *)notarizeButtonTitle cancelButtonTitle:(NSString *)cancelButtonTitle notarizeAction:(returnNotarize)notarize cancelAction:(returnCancel)cancel;
- /**
- 弹出alert 配一个button
- @param title alert的标题
- @param message alert的详细信息
- @param viewController 要弹出alert的控制器
- @param defaultButtonTitle 默认按钮的title传nil的话显示@"确认"
- @param defaultAction 点击默认按钮的回调
- */
- + (void)alertControllerOneButtonWithTitle:(NSString *)title message:(NSString *)message target:(UIViewController *)viewController defaultButtonTitle:(NSString *)defaultButtonTitle defaultAction:(returnNotarize)defaultAction;
- /**
- 判断相机是否可用 若不可用会弹出一个alertController 点击确认跳转到设置 取消进行NotAvailable block的操作
- @param viewController 要在哪个页面调用相机
- @param Available 相机可用时的block
- @param NotAvailable 相机不可用时的block
- */
- + (void)controller:(UIViewController *)viewController CameraIsAvailable:(Available)Available OrNotAvailable:(NotAvailable)NotAvailable;
- /**
- 判断相册是否可用 若不可用会弹出一个alertController 点击确认跳转到设置 取消进行NotAvailable block的操作
- @param viewController 要在哪个页面调用相册
- @param Available 相册可用时的block
- @param NotAvailable 相册不可用时的block
- */
- + (void)controller:(UIViewController *)viewController AlbumIsAvailable:(Available)Available OrNotAvailable:(NotAvailable)NotAvailable;
- /**
- 倒计时
- @param countTime 倒计时的时间(秒)
- @param counting 倒计时中的block
- @param finished 完成的block
- */
- + (void)countDownWithTime:(NSInteger)countTime AndCounting:(void(^)(NSInteger count))counting AndFinished:(void(^)(void))finished;
- + (void)actionSheetWithTitleArray:(NSMutableArray *)titleArray target:(UIViewController *)viewController notarizeAction:(returnNotarizeWithIdx)returnNotarizeWithIdx;
- /**
- @return 是否是刘海屏系列
- */
- + (BOOL)isHaveBang;
- /**
- @ 设置行间距和字号
- */
- +(void)setLabelSpace:(UILabel*)label withSpace:(CGFloat)space withFont:(UIFont*)font;
- /// 设置首行缩进和行距
- +(void)setLabelFirstLineHeadIndent:(UILabel*)label withSpace:(CGFloat)space withFont:(UIFont*)font setTing:(NSUInteger)headIndent;
- /// 设置 行间距 首行缩进 字距
- +(void)setLabel:(UILabel*)label withSpace:(CGFloat)space withFont:(UIFont*)font setLineSpace:(NSUInteger)headIndent setTextSpace:(CGFloat)textspace;
- /// 处理返回信息中的错误
- + (NSString *)handerResultData:(NSError *)error;
- + (BOOL)isNullToDictionary:(NSDictionary *)dict;
- /// 2019-11-20 10:46:48 ---> 11-20 10:46
- + (NSString *)monthAndDayAndHoursAndMinutes:(NSString *)dateString;
- /// 2019-11-20 10:46:48 ---> 2019-11-20 10:46
- /// @param dateString 2019-11-20
- + (NSString *)yearMonthAndDay:(NSString *)dateString;
- /// 2019-11-20 10:46:48 ---> 2019/11/20 10:46
- + (NSString *)yearMonthAndDayHourMinuesSecond:(NSString *)dateString;
- /// 99999 --> 9.9万 9999 --> 9.9千 999--->9.9百 99-->99
- + (NSString *)getCommenttext:(NSInteger)number;
- /// NSMutableSet ---> NSMutableArray
- + (NSMutableArray *)setToArray:(NSMutableSet *)set;
- /// 2019年12月12日
- + (NSString *)getYearAndMonthAndDay;
- /// 2019-11-20 10:46:48 ---> 11月20日
- + (NSString *)MonthAndDay:(NSString *)dateString;
- + (NSDate *)StringReturnDate:(NSString *)dateString;
- + (NSMutableAttributedString *)checkOfString:(NSString *)infoStr KeyString:(NSString *)keyString;
- + (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text;
- + (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text withColor:(UIColor *)color;
- + (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text bgtextColor:(UIColor *)bgColor foreTextColor:(UIColor *)foreColor font:(UIFont *)font;
- + (NSString *)getFileNameImage:(NSString *)fileName;
- + (CollectDataType)returnDataType:(CollectModelType)type;
- @end
|