YHUtils.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // HHUtils.h
  3. // HipHopBattle
  4. // CSDN: http://blog.csdn.net/samuelandkevin
  5. // Created by samuelandkevin on 14-6-26.
  6. // Copyright (c) 2014年 Dope Beats Co.,Ltd. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #include <sys/param.h>
  10. #include <sys/mount.h>
  11. typedef void(^HHAlertCallback)(BOOL resultYes );
  12. @interface YHUtils : NSObject
  13. /**
  14. * 获取文件MD5值
  15. */
  16. + (NSString *)getFileMD5WithPath:(NSString*)path;
  17. + (NSString *)getFileMD5WithData:(NSData *)data;
  18. + (UIView *)rotate360DegreeWithView:(UIView *)imageView;
  19. #pragma mark - 弹窗页面
  20. + (void)showSingleButtonAlertWithTitle:(NSString *)title message:(NSString *)msg okTitle:(NSString *)okString dismiss:(HHAlertCallback)callback;
  21. + (void)showAlertWithTitle:(NSString *)title message:(NSString *)msg dismiss:(HHAlertCallback)callback;
  22. + (void)showAlertWithTitle:(NSString *)title message:(NSString *)msg okTitle:(NSString *)okString cancelTitle:(NSString *)cancelString inViewController:(UIViewController *)vc dismiss:(HHAlertCallback)callback;
  23. + (void)showAlertWithTitle:(NSString *)title message:(NSString *)msg okTitle:(NSString *)okString cancelTitle:(NSString *)cancelString dismiss:(HHAlertCallback)callback;
  24. + (NSDictionary *)parseUrlParameters:(NSURL *)url;
  25. + (void)postTip:(NSString *)tipsTitle RGB16:(int)hexColor complete:(void(^)())completeCallback;
  26. + (void)postTip:(NSString *)tipsTitle RGB16:(int)rgbValue keepTime:(NSTimeInterval)interval complete:(void(^)())completeCallback;
  27. + (void)postTip:(NSString *)tipsTitle RGBcolorRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue keepTime:(NSTimeInterval)time complete:(void(^)())completeCallback;
  28. + (void)dismissAlertWithClickedButtonIndex:(NSInteger)buttonIndex
  29. animated:(BOOL)animated;
  30. + (long long)freeDiskSpaceInBytes;
  31. /**
  32. * MD5加密字符串
  33. *
  34. * @param input 字符串
  35. *
  36. * @return 加密后的字符串
  37. */
  38. + (NSString *)md5HexDigest:(NSString*)input;
  39. /**
  40. * 获取iPhone机型
  41. *
  42. * @return
  43. */
  44. + (NSString*)phoneType;
  45. /**
  46. * 获取iPhone系统
  47. *
  48. * @return eg:iOS8.1
  49. */
  50. + (NSString *)phoneSystem;
  51. /**
  52. * appStore上的版本号
  53. *
  54. * @return
  55. */
  56. + (NSString *)appStoreNumber;
  57. /**
  58. * app开发环境版本号
  59. *
  60. * @return
  61. */
  62. + (NSString *)appBulidNumber;
  63. + (BOOL)compareWithBeginDateString:(NSString *)beginDateString andEndDateString:(NSString *)endDateString;
  64. + (NSDate *)dateFromString:(NSString *)dateString;
  65. + (NSString *)getNormalShowDateString:(NSString *)dateString;
  66. @end
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70. /**
  71. 返回文件长度,以字节为单位
  72. */
  73. int getFileSize(NSString *path);
  74. NSString * getDeviceVersion();
  75. NSString * platformString ();
  76. /**
  77. 比较不同数组中不同的ID(与上一次的缓存对比)
  78. @return 返回与是一次是否有变化
  79. */
  80. BOOL compareStringIdsDiff( NSArray *allphones, NSString *phonesCacheFilePath, NSArray **addlist, NSArray **removelist );
  81. #ifdef __cplusplus
  82. }
  83. #endif