// // RAUtils.h // RedAnt ERP Mobile // // Created by Ray on 9/17/15. // Copyright (c) 2015 United Software Applications, Inc. All rights reserved. // #import #import //typedef struct { // // NSString* id; // // float height; // // //}MyTestStruct; NS_ASSUME_NONNULL_BEGIN @interface RAUtils : NSObject + (CGSize)sizeWithFont:(NSString*_Nonnull)string font:(UIFont *_Nonnull)font constrainedToSize:(CGSize)size lineBreakMode:(NSLineBreakMode)lineBreakMode; + (BOOL)isNumeric:(NSString*)string; //+(NSData*) dict2data:(NSDictionary*) dict; +(NSString*) FloatFormat:(float)value; +(UIViewController*) getViewController:(UIView*) view; + (CGRect)relativeFrameForScreenWithView:(UIView *)v; +(NSDictionary*) error_json :(int)code err_msg:(NSString* _Nullable)msg; +(UIAlertController*) message_alert :(NSString* _Nullable) msg title:(NSString*_Nullable) title controller:(UIViewController*) vc; +(UIAlertController*) message_alert :(NSString*) msg title:(NSString*) title controller:(UIViewController*) vc action_handler:(void (^ __nullable)(UIAlertAction *action))action_handler completion:(void (^ __nullable)(void))completion; //+(void) alert_view :(NSString*) msg title:(NSString*) title ; //+(UIAlertView * ) waiting_alert :(NSString*) msg title:(NSString*) title; //+(UIAlertController*) waiting_alert:(UIViewController*)parent title:(NSString*_Nullable) title; +(UIAlertController*) waiting_alert:(UIViewController*)parent title:(NSString*) title completion:(void (^ __nullable)(void))completion; //+(UIAlertController*) waiting_alert:(UIViewController*)parent message:(NSString*_Nullable)msg title:(NSString*_Nullable) title; +(UIAlertController*) waiting_alert:(UIViewController*)parent message:(NSString*)msg title:(NSString*) title completion:(void (^ __nullable)(void))completion; + (float)fileSizeForDir:(NSString*)path;//计算文件夹下文件的总大小; +(void) deletefiles :(NSString*) path; +(UIColor*) strColor:(NSString*) color; +(NSString*) get_config_path; +(NSString*) base64en:(NSString*) string; +(NSString*) base64de:(NSString*) string; +(NSDictionary*) device_info; +(NSDictionary*) error_dict:(NSError*)error; + (NSArray*) allFilesAtPath:(NSString*) dirString; //+(void) enum_font; +(NSDictionary*) dictfromfile:(NSString*) path; //+(NSArray*) expression_varable:(NSString*)content regex:(NSString*) pattern; //+(NSTextCheckingResult*) expression_findfistMatch:(NSString*)content regex:(NSString*) pattern; +(NSData*) getdbfile:(NSString*)dbname; +(NSString*) getdbzip:(NSString*)dbname; + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size; + (CGRect)scaleToSize:(CGRect )from to:(CGSize)to; + (CGRect)rectAlign:(CGRect )parent rect:(CGRect)rect hAlign:(NSString*)hAlign vAlign:(NSString*)vAlign; + (CGRect)rectVAlign:(CGRect )parent rect:(CGRect)rect vAlign:(NSString*)vAlign; +(UIImage*)img_compress:(UIImage*)image kbsize:(float) size; +(NSString* )current_date; +(NSString*) current_date_forfile; +(NSMutableArray*)dictionary2array:(NSDictionary*)json count_fields:(NSString*) count_fields item_mark:(NSString*) item_mark items_mark:(NSString* _Nullable )items_mark; +(int)getRandomNumber:(int)from to:(int)to; //+(void) add_recent_model:(NSDictionary*) model; + (long long) freeDiskSpaceInMegaBytes; //+(NSArray*) string2arr:(NSString*) string separator:(NSString*)separator; + (bool)mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir error:(NSError**)err; + (BOOL)saveData:(NSData *)data toPath:(NSString *)path; + (void)removeFileAtPath:(NSString *)path; + (NSString *)appCacheDirectory; +(NSString*)md5WithFile:(NSString*)path; + (BOOL)fileExistsAtPath:(NSString *)path; + (NSString *)htmlForVideo:(NSString*) iframeCode template:(NSString*) path; + (NSString *)htmlForImage:(UIImage *)image template:(NSString*) path; + (CGRect)relativeFrame:(CGRect) frame FromView:(UIView *)v toView:(UIView*)tv; + (nullable NSString *)md5:(nullable NSString *)str; + (NSString *_Nullable)deviceID; + (void)ra_showAlertTitle:(NSString *_Nullable)title message:(NSString *_Nullable)msg withViewController:(UIViewController *_Nonnull)vc; @end NS_ASSUME_NONNULL_END