GlobalMethod.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // GlobalMethod.h
  3. // 米兰港
  4. //
  5. // Created by 隋林栋 on 15/3/3.
  6. // Copyright (c) 2015年 Sl. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. @class NSDictionary;
  11. @interface GlobalMethod : NSObject
  12. //解析错误信息
  13. + (NSString *)returnErrorMessage:(id)error;
  14. //去掉空格
  15. + (NSString *)exchangeEmpty:(NSString *)str;
  16. //去掉换行
  17. + (NSString *)exchangeBlack:(NSString *)str;
  18. //处理小数点
  19. + (NSString *)exchangeNum:(double)num;
  20. //转换为jsong
  21. + (NSString *)exchangeDicToJson:(id)object;
  22. //转换为jsong
  23. + (NSString *)exchangeModelsToJson:(NSArray *)object;
  24. //转换json
  25. + (NSString *)exchangeModelToJson:(id)model;
  26. //delegate 执行 selector
  27. + (id)performSelector:(NSString *)selectorName delegate:(id)delegate;
  28. + (id)performSelector:(NSString *)selectorName delegate:(id)delegate object:(id)object isHasReturn:(BOOL)isHasReturn;
  29. + (id)performSelector:(NSString *)selectorName delegate:(id)delegate object:(id)object object:(id)object2 isHasReturn:(BOOL)isHasReturn;
  30. //转换String to dic
  31. + (NSDictionary *)exchangeStringToDic:(NSString *)str;
  32. //转换data to dic
  33. + (NSDictionary *)exchangeDataToDic:(NSData *)data;
  34. //转换String to ary
  35. + (NSArray *)exchangeStringToAry:(NSString *)str;
  36. //转换 dic to model
  37. + (id)exchangeDicToModel:(id)dic modelName:(NSString *)strName;
  38. //转换dic to ary
  39. + (NSMutableArray *)exchangeDic:(id)response toAryWithModelName:(NSString *)modelName;
  40. + (NSMutableArray *)exchangeAryModelToAryDic:(NSArray *)response;
  41. //移除空白
  42. + (void)removeEmpty:(NSMutableArray *)ary key:(NSString *)strKey;
  43. //十六进制转颜色
  44. + (UIColor *)exchangeColorWith16:(NSString*)hexColor;
  45. //十六进制转颜色 alpha
  46. + (UIColor *)exchangeColorWith16:(NSString*)hexColor alpha:(CGFloat)alpha;
  47. //隐藏显示tag视图
  48. + (void)showHideViewWithTag:(int)tag inView:(UIView *)view isshow:(BOOL)isShow;
  49. //显示提示
  50. + (void)showAlert:(NSString *)strAlert;
  51. //显示正在开发中
  52. +(void)showAlertDeveloping;
  53. //获取版本号
  54. + (NSString *)getVersion;
  55. //获取APP名字
  56. + (NSString *)getAppName;
  57. /**
  58. *获取设备型号
  59. */
  60. + (NSString *)LookDeviceName;
  61. //适配label字号
  62. + (CGFloat)adaptLabelFont:(CGFloat)fontNum;
  63. #pragma mark 角标清零
  64. + (void)zeroIcon;
  65. #pragma mark 根据推送的消息进行跳转
  66. + (void)jumpWithPushJson;
  67. +(NSString *)removeHTML:(NSString *)html;
  68. #pragma mark 拼写文件名
  69. + (NSString *)fetchDoumentPath:(NSString *)name;
  70. #pragma mark 弹出提示
  71. + (void)showNotiInStatusBar:(NSString *)strMsg msg:(NSString *)msg bageNum:(int)msgCount;
  72. #pragma mark 跳转页面
  73. #pragma mark 判断推送状态
  74. //+ (BOOL)IsEnablePush;
  75. #pragma mark 判断网络状态
  76. + (BOOL)IsEnableNetwork;
  77. + (BOOL)IsEnableWifi;
  78. + (BOOL)IsENable3G;
  79. #pragma mark 获取文件大小
  80. + (NSString *)fetchDoumentSize;
  81. #pragma mark encode decode
  82. +(NSString*)encodeString:(NSString*)unencodedString;
  83. +(NSString*)decodeString:(NSString*)encodedString;
  84. #pragma mark 获取汉字首字母
  85. + (NSString *)fetchFirstCharactorWithString:(NSString *)str;
  86. #pragma mark 收键盘
  87. + (void)hideKeyboard;
  88. #pragma mark - 获取地图Bundle中turnIcon图片
  89. +(UIImage *)getImageFromAMapNaviBundle:(NSString *)imageName;
  90. #pragma mark - 返回NSAttributedString并且带图片
  91. + (NSAttributedString *)returnNSAttributedStringWithContentStr:(NSString *)labelStr titleColor:(UIColor *)titleColor withlineSpacing:(CGFloat)lineSpacing withAlignment:(NSInteger)alignment withFont:(UIFont *)font withImageName:(NSString *)imageName withImageRect:(CGRect)rect withAtIndex:(NSUInteger)index;
  92. //字符串数组转化为字符串
  93. +(id)parseJSONStringToNSDictionary:(NSString *)JSONString;
  94. //获取所在vc
  95. + (UIViewController *)fetchVCWithView:(UIView *)view;
  96. +(void)jumpToChatVCChatter:(NSString *)chatter type:(int)type dic:(NSDictionary *)dic;
  97. +(NSUInteger)textLength: (NSString *) text;
  98. @end