MacroFile.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. //
  2. // MacroFile.h
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/3/9.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #ifndef MacroFile_h
  9. #define MacroFile_h
  10. #endif /* MacroFile_h */
  11. /*
  12. -----------------------------------------------------------------------------------
  13. ------------------------环境切换 版本号 客服电话 客户端来源---------------------------
  14. -----------------------------------------------------------------------------------
  15. */
  16. #define NewAppKey @"" //服务平台每个项目的appKey 签名密钥 开发环境
  17. #define NewDeviceClass @"iphone" //客户端来源
  18. #define NewSecurityCode @"" //安全码
  19. #define NewVersionNumber @"1.0" //当前项目版本号
  20. #define NewAppletSwitch @"0"//小程序入口开关,0是关,1是开
  21. #define NewLogSwitch @"1"//日志打印开关,0是关,1是开
  22. #define NewServiceTelephone @"" //服务电话
  23. #define NewMailbox @"" //邮箱
  24. #define NewShareURL @"" //微信分享的默认链接使用
  25. /**
  26. * 弹窗消息Title提示
  27. */
  28. #define NewMessageDisplayTime 10 //消息展示时间
  29. #define NewPushTitle @"技淘"
  30. #define NewPushImage [UIImage imageNamed:@"推送图标"]
  31. #define NewReminderTitle @"温馨提示"
  32. #define NewNoNetworkTitle @"网络不给力,请检查网络设置。"
  33. #define NewNoNetworkImage [UIImage imageNamed:@"推送图标"]
  34. //公共通知Key
  35. #define NewJitaoServerPublicNotification @"消息推送"
  36. #define NewtuisongManageNotification @"通知跳转"
  37. #define SERVER_HTML5_URL @"" //H5开发环境
  38. //#define SERVER_HTML5_URL @"" //H5发布环境
  39. //#define OSSUpload_URL @"" //上传图片/视屏/文件URL
  40. //苹果内购 沙盒测试环境验证
  41. #define Pay_SANDBOX @"https://sandbox.itunes.apple.com/verifyReceipt"
  42. //苹果内购 正式环境验证
  43. #define Pay_AppStore @"https://buy.itunes.apple.com/verifyReceipt"
  44. /*
  45. -----------------------------------------------------------------------------------
  46. --------------------------------------用户信息--------------------------------------
  47. -----------------------------------------------------------------------------------
  48. */
  49. #define NewAccountNumber @"newAccountNumber" //账号
  50. #define NewAccountPassword @"newAccountPassword" //账号密码
  51. #define NewOpenId @"newOpenId" //账号唯一标识符 一个共同的账号在每个项目的userId不一样,但OpenId是一样的
  52. #define NewUsername @"newUsername" //用户名称
  53. #define NewMobileNumber @"newMobileNumber" //用户手机号码
  54. #define NewToken @"newtoken" //令牌 登录有效期
  55. #define NewType @"newtype" //类别 个人or企业
  56. #define NewID @"newID" //用户ID
  57. #define NewHXUsername @"newHXUsername" //环信账号
  58. #define NewHXPassword @"newHXPassword" //环信密码
  59. #define NewHXheadUrl @"NewHXheadUrl" //用户头像
  60. /*
  61. -----------------------------------------------------------------------------------
  62. -------------------------------------工具类key值------------------------------------
  63. -----------------------------------------------------------------------------------
  64. */
  65. //项目版本key
  66. #define NewAPPVersion @"NewAPPVersion"
  67. #define NewLocationCue @"NewLocationCue"
  68. /*
  69. -----------------------------------------------------------------------------------
  70. ---------------------------------第三方SDK对应的key值--------------------------------
  71. -----------------------------------------------------------------------------------
  72. */
  73. //微信
  74. #define WXKey @"wx60c918b577a3885d"
  75. #define WXAppSecret @"64a3a2fa27eec87d996fa20c44a7f041"
  76. //极光推送
  77. #define JPushKey @"dbcea43366e038073452a04e"//新的极光
  78. //#define JPushKey @"36944c5628d34ff997f56dcd"
  79. //环信APPKEY
  80. #define HXAPPKey @"1117170814115609#jitao"
  81. #define JPushChannel @""//发布渠道. 可选.
  82. #define JPushIsProduction 1 //是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为 YES.
  83. /*
  84. -----------------------------------------------------------------------------------
  85. --------------------------------------Java接口标识--------------------------------------
  86. -----------------------------------------------------------------------------------
  87. */
  88. //#define SERVER_URL @"http://192.168.1.213:8080/" //辉哥本地环境
  89. //#define SERVER_URL @"http://192.168.0.99:8080/" //贺纯安本地环境
  90. //#define SERVER_URL @"http://192.168.1.115:8080/" //彭本地环境
  91. //#define SERVER_URL @"http://uat.jishutao.com/" //测试环境
  92. //#define HTML5_URL @"http://muat.jishutao.com/" //H5页面测试地址
  93. #define SERVER_URL @"http://www.jishutao.com/" //生产地址
  94. #define HTML5_URL @"http://m.jishutao.com/" //H5页面生产地址
  95. #define HXKF @"888878" //测试环信客服
  96. //#define HXKF @"88888888" //生产环信客服
  97. //文件上传 图片/视频 地址:
  98. #define OSSUpload_URL @"http://ss.jishutao.com/upload"//生产
  99. //#define OSSUpload_URL @"http://statics.jishutao.com/upload"//测试环境 非上传
  100. #define OSSUpload_URLNew @"http://statics.jishutao.com/portal/1.0.0"//废弃
  101. //#define OSSUpload_URL @"http://sb.jishutao.com/upload"//开发环境
  102. #define JT_signin @"mlogin" //登录
  103. #define JT_getAppMCode @"open/getRegisterMCode" //注册 下发短信
  104. #define JT_register @"mregister" //注册
  105. #define JT_getResetMCode @"open/getResetMCode"//修改密码 下发短信
  106. #define JT_resetPwd @"app/user/updatePassword" //修改密码
  107. #define JT_appResetPwd @"open/appResetPwd" //忘记密码
  108. #define JT_uploadImg @"app/user/uploadImg" //上传头像
  109. #define JT_updateUser @"app/user/updateUser" //更新用户信息(修改用户名)
  110. #define JT_userInfo @"app/user/userInfo" //获取用户基本信息
  111. #define JT_logout @"app/user/logout" //退出用户登录
  112. #define JT_industryList @"open/app/discovery/industryList" //(发现)行业分类列表
  113. #define JT_achievementList @"open/app/discovery/achievementList" //(发现)科技成果列表
  114. #define JT_demandList @"open/app/discovery/demandList" //(发现)科技需求列表
  115. #define JT_expertsList @"open/app/discovery/expertsList" //(发现)科技专家列表
  116. #define JT_achievementDetail @"open/app/user/achievementDetail" //(发现)科技成果详情
  117. #define JT_demandDetail @"open/app/user/demandDetail" //(发现)科技需求详情
  118. #define JT_expertsDetail @"open/app/user/expertsDetail" //(发现)科技专家详情
  119. #define JT_interestAdd @"app/user/interestAdd" //关注
  120. #define JT_interestList @"app/user/interestList" //关注列表
  121. #define JT_MydemandList @"app/user/demandList" //(我的)我的需求列表
  122. #define JT_MyachievementList @"app/user/achievementList" //(我的)我的成果列表
  123. #define JT_listMessage @"app/user/listMessage" //(我的)系统消息
  124. #define JT_readMessage @"app/user/readMessage" //(我的)系统消息详情
  125. #define JT_getVarieties @"open/app/service/getVarieties" //(服务)获取初级品类
  126. #define JT_recommendProjectList @"open/app/service/recommendProjectList" //(服务)推荐列表
  127. #define JT_consultantList @"open/app/service/consultantList" //(服务)一对一
  128. #define JT_consultantDetail @"open/app/service/consultantDetail" //(服务)咨询师详情
  129. #define JT_getBusinessProject @"open/app/service/getBusinessProject" //(服务)获取品类下项目
  130. #define JT_synBindingAccount @"app/user/synBindingAccount" //绑定极光账号
  131. #define JT_indext @"open/app/user/index" //(淘信)APP首页消息
  132. #define JT_getImagers @"open/app/service/getImagers" //(服务)服务轮播图
  133. #define JT_toAddIntention @"app/order/toAddIntention" //进入添加意向订单
  134. #define JT_addIntention @"app/order/addIntention" //添加意向订单
  135. #define JT_orderList @"app/order/orderList" //查询意向列表(订单列表通用)
  136. #define JT_fundingHistory @"app/order/fundingHistory" //查询支付流水
  137. #define JT_applyForCancel @"app/order/applyForCancel" //取消订单
  138. #define JT_payForFirst @"app/order/payForFirst" //支付首付
  139. #define JT_payForLast @"app/order/payForLast" //支付尾款
  140. #define JT_confirmIntention @"app/order/confirmIntention" //确认意向订单
  141. #define JT_applyForWithdraw @"app/order/applyForWithdraw" //提现
  142. #define JT_orderDetails @"app/order/orderDetails" //查看订单详情
  143. #define JT_advertising @"open/app/discovery/advertising" //发现模块广告推荐信息
  144. #define JT_fundingHistory @"app/order/fundingHistory" //查询支付流水
  145. #define JT_ProjectDetail @"open/app/service/ProjectDetail" //项目详情
  146. #define JT_getField @"app/user/getField" //获取行业类型
  147. #define JT_uploadPicture @"app/user/uploadPicture" //上传成果、需求图片
  148. #define JT_appAddAchievement @"app/user/appAddAchievement" //发布成果
  149. #define JT_appAddDemand @"app/user/appAddDemand" //发布需求
  150. #define JT_getHomePageData @"open/app/home/getHomePageData" //获取首页数据
  151. #define JT_getHomeRecommended @"open/app/home/getHomeRecommended" //获取首页技淘推荐
  152. #define JT_applyForRefund @"app/order/applyForRefund" //申请退款
  153. #define JT_confirmRefund @"app/order/confirmRefund" //同意/拒绝退款
  154. /*
  155. -----------------------------------------------------------------------------------
  156. --------------------------------------新版本API--------------------------------------
  157. -----------------------------------------------------------------------------------
  158. */
  159. #define JT_NeworderList @"app/user/orderList"//我的订单列表
  160. #define JT_NewapplyComment @"app/order/applyComment"//新增评价
  161. #define JT_NewappMyInterested @"app/user/appMyInterested"//我的关注
  162. #define JT_NewappMyCollection @"app/user/appMyCollection"//我的收藏
  163. #define JT_NewappAchievementList @"app/user/appAchievementList"//我的成果列表
  164. #define JT_NewappdemandList @"app/user/demandList"//我的需求列表
  165. #define JT_NewlistPolicy @"open/app/discovery/listPolicy"//政策列表(详情直调数据)
  166. #define JT_NewlistInformation @"open/app/discovery/listInformation"//资讯列表(详情直调数据)
  167. #define JT_NewlistEncyclopedia @"open/app/discovery/listEncyclopedia"//资产百科(详情直调数据)
  168. #define JT_NewlistJtViewpoint @"open/app/discovery/listJtViewpoint"//
  169. #define JT_NewconsultantList @"open/app/discovery/consultantList"//顾问列表
  170. #define JT_NewexpertsDetail @"open/app/user/expertsDetail"//专家、顾问详情
  171. #define JT_NewprojectComment @"open/app/home/projectComment"//项目评价
  172. #define JT_NewgetHomeData @"open/app/home/getHomeData"//获取首页数据
  173. #define JT_NewrecommendedApplication @"open/app/home/recommendedApplication"//赚钱首页
  174. #define JT_NewdemandDetail @"open/app/user/demandDetail"//需求详情
  175. #define JT_NewachievementDetail @"open/app/user/achievementDetail"//成果详情
  176. #define JT_NewsubmitOrder @"app/order/submitOrder"//提交订单
  177. #define JT_NewsubmitConsultOrder @"app/order/submitConsultOrder"//专家、顾问订单提交
  178. #define JT_NewexpertsComment @"open/app/user/expertsComment"//专家 顾问评价
  179. #define JT_NewindustryList @"open/industryList"//获取行业列表
  180. #define JT_NewachievementList @"open/app/discovery/achievementList"//成果列表
  181. #define JT_NewdemandList @"open/app/discovery/demandList"//需求列表
  182. #define JT_NewprojectLis @"open/app/home/projectList"//项目列表
  183. #define JT_NewexpertsList @"open/app/discovery/expertsList"//专家列表
  184. #define JT_NewcategoryList @"open/app/home/categoryList"//赚钱更多分类
  185. #define JT_NewupdateDemand @"app/user/updateDemand"//修改需求
  186. #define JT_NewupdateAchievement @"app/user/updateAchievement"//修改成果
  187. #define JT_NewappAddAchievement @"app/user/appAddAchievement"//发布成果
  188. #define JT_NewappAddDemand @"app/user/appAddDemand"//发布需求
  189. #define JT_NewprojectDetail @"open/app/home/projectDetail"//项目详情
  190. #define JT_NewprojectComment @"open/app/home/projectComment"//项目评价
  191. #define JT_NewinterestAdd @"app/user/interestAdd"//关注功能
  192. #define JT_NewgetCategoryList @"open/app/home/getCategoryList"//知识产权更多分类
  193. #define JT_NewapplistMessage @"app/user/applistMessage"//我的消息列表
  194. #define JT_NewreadMessage @"app/user/appReadMessage"//消息详情
  195. /*
  196. -----------------------------------------------------------------------------------
  197. --------------------------------------常用的宏--------------------------------------
  198. -----------------------------------------------------------------------------------
  199. */
  200. //第三方代码计算出的获取唯一设备标识符
  201. #define NewUDID [OpenUDID value]
  202. //WebView加载超时计时时间
  203. #define WebViewOverTimeMark 60.0f
  204. //录音音量 1~10
  205. #define NewAudioVolume 10.0f
  206. //轮播图片时长
  207. #define CarouselTime 3.0f
  208. //普通轮播图片高度
  209. #define headwheelHeight fitScreenHeight(179)
  210. #define homeHeadImageHEIGHT fitScreenWidth(188) //首页轮播图片高度
  211. /**
  212. * Version
  213. */
  214. #define ISIOS7 ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)//系统版本号
  215. #define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)//判断iPhone和iPad
  216. /**
  217. * 屏幕高度
  218. */
  219. #define NavHeader [NewUtils navHeader]
  220. #define TABBAR_HEIGHT [NewUtils navTABBAR_HEIGHT] //菜单栏高
  221. #define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width //屏幕宽度
  222. #define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height //屏幕高度
  223. //#define TABBAR_HEIGHT 49.0 //菜单栏高
  224. #define NAV_HEIGHT 44.0 //导航栏高
  225. #define STATUSBAR_HEIGHT 20.0 //状态栏
  226. #define ViewStartY [NewUtils navHeader] //导航条高度
  227. #define SELF_VIEW_HEIGHT (SCREEN_HEIGHT-ViewStartY) //不算导航条的高度
  228. #define fitScreenWidth(width) width*(SCREEN_WIDTH/375)
  229. #define fitScreenHeight(height) height*(SCREEN_HEIGHT/667)
  230. #define SafeAreaTopHeight (SCREEN_WIDTH == 812.0 ? 88 : 64)
  231. #define ICONS_WIDTH 16.0 //小图标宽
  232. #define ICONS_HEIGHT 22.0 //小图标高
  233. /**
  234. * 自定义颜色
  235. */
  236. #define NewRGBColor(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]//16进制颜色值
  237. //iOS10 苹果官方提供的sRGB
  238. #define NewS1RGBColor(R,G,B,A) [UIColor colorWithDisplayP3Red:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
  239. #define NewS2RGBColor(R,G,B,A) [UIColor initWithDisplayP3Red:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
  240. //+ (UIColor *)colorWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
  241. //- (UIColor *)initWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
  242. //16进制颜色转换
  243. //#define UIColorFromRGBA(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  244. #define NewClearColor [UIColor clearColor] //无
  245. #define NewWhiteColor [UIColor whiteColor] //白
  246. #define NewBlackColor [UIColor blackColor] //黑
  247. #define NewPurpleColor [UIColor purpleColor]//紫
  248. #define NewRedColor [UIColor redColor] //红
  249. #define NewYellowColor [UIColor yellowColor]//黄
  250. #define NewOrangeColor [UIColor orangeColor]//橙
  251. #define NewBlueColor [UIColor blueColor]//蓝
  252. #define NewLightGrayColor [UIColor lightGrayColor]//深灰
  253. #define NewCellLineColor NewRGBColor(200, 199, 204, 1) //单元格的Cell横线颜色 宽度约为0.6
  254. #define NewIphoneNumberColor NewRGBColor(0, 136, 232, 1) //电话字体颜色
  255. #define NewGroupTableViewBackgroundColor [UIColor groupTableViewBackgroundColor] //浅灰
  256. //#define NewButtonColor [UIColor colorWithRed:255.0/255.0 green:150.0/255.0 blue:38.0/255.0 alpha:1.0] //常用按钮浅橙色 UIColorFromRGBA(0xff9626)
  257. #define NewButtonColor [UIColor colorWithString:@"#26A8F7"]
  258. #define NewNavigationColor [UIColor colorWithRed:236.0/255.0 green:236.0/255.0 blue:236.0/255.0 alpha:1.0] //导航条灰色 UIColorFromRGBA(0xf8c392)
  259. //#define NewNavigationColor [UIColor colorWithString:@"#FF0000"]//导航条
  260. #define NewThemeColor [UIColor colorWithRed:239.0/255.0 green:51.0/255.0 blue:83.0/255.0 alpha:1.0]
  261. //#define NewLineGrayColor [UIColor colorWithRed:229.0/255 green:229.0/255 blue:229.0/255 alpha:1.0] //灰线
  262. #define NewLineGrayColor [UIColor colorWithString:@"#F2F2F2"]
  263. #define NewBgGrayColor [UIColor colorWithRed:239.0/255 green:239.0/255 blue:244.0/255 alpha:1.0] //灰色背景
  264. #define NewGrayColor [UIColor colorWithRed:105/255.0 green:105/255.0 blue:105/255.0 alpha:1.0] //灰
  265. #define NewGray2Color [UIColor colorWithRed:171/255.0 green:171/255.0 blue:171/255.0 alpha:1.0] //浅灰
  266. #define NewDarkGrayColor [UIColor colorWithRed:46/255.0 green:46/255.0 blue:46/255.0 alpha:1.0] //深灰
  267. #define NewImgBgColor [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]
  268. #define NewNoDataColor [UIColor colorWithRed:167.0/255.0 green:174.0/255.0 blue:186.0/255.0 alpha:1.0] //无数据字体颜色
  269. /**
  270. * View 圆角和加边框
  271. */
  272. #define ViewBorderRadius(View, Radius, Width, Color)\
  273. \
  274. [View.layer setCornerRadius:(Radius)];\
  275. [View.layer setMasksToBounds:YES];\
  276. [View.layer setBorderWidth:(Width)];\
  277. [View.layer setBorderColor:[Color CGColor]]
  278. /**
  279. * View 圆角
  280. */
  281. #define ViewRadius(View, Radius)\
  282. \
  283. [View.layer setCornerRadius:(Radius)];\
  284. [View.layer setMasksToBounds:YES]
  285. /**
  286. * 字体
  287. */
  288. #define NewFont(fontSize) [UIFont systemFontOfSize:fontSize]//细体字号
  289. #define NewBFont(fontSize) [UIFont boldSystemFontOfSize:fontSize]//粗体字号
  290. #define ChangeProportion (SCREEN_WIDTH/320.0)
  291. #define NewAutoFont(fontSize) ChangeProportion>1?NewFont(fontSize+2):NewFont(fontSize)//根据屏幕宽度返回细字体
  292. #define NewBAutoFont(fontSize) ChangeProportion>1?NewBFont(fontSize+2):NewBFont(fontSize)//根据屏幕宽度返回粗字体
  293. /**
  294. * 字符串拼接
  295. */
  296. #define NewStringFormat(xfmt, ...) [NSString stringWithFormat:xfmt, ##__VA_ARGS__]
  297. /**
  298. * 字符串比较
  299. */
  300. #define NewEqualString(xParameter1, xParameter2) [xParameter1 isEqualToString:xParameter2]
  301. /**
  302. * 对象初始化
  303. */
  304. #define NewInit(xClass) [[xClass alloc] init]
  305. #define NewInitWithName(xClass,initName) xClass *initName = NewInit(xClass)
  306. /**
  307. * MutableArrayInit 可变数组初始化
  308. */
  309. #define NewMutableArrayInit [NSMutableArray array]
  310. /**
  311. * MutableDictionaryInit 可变字典初始化
  312. */
  313. #define NewMutableDictionaryInit [NSMutableDictionary dictionary]
  314. /**
  315. * 对象初始化且添加Frame
  316. */
  317. #define NewInitWithParameter(xClass,initName,xInitFrame) xClass *initName = [[xClass alloc] initWithFrame:xInitFrame]
  318. /**
  319. * Frame
  320. */
  321. #define NewFrame(xmx,xmy,xw,xh) CGRectMake(xmx,xmy,xw,xh)
  322. /**
  323. * Button点击事件
  324. */
  325. #define NewTouchUpInside(touchName,touchAction) [touchName addTarget:self action:@selector(touchAction) forControlEvents:UIControlEventTouchUpInside]
  326. /**
  327. * UIImage初始化
  328. */
  329. #define NewImageNamed(imageNameString) [UIImage imageNamed:imageNameString]
  330. /**
  331. * UIImageView初始化且添加图片
  332. */
  333. #define NewImgInit(xClass,initName,pImg) xClass *initName = [[xClass alloc] initWithImage:pImg]
  334. /**
  335. * SafeRelease MRC状态下手动释放内存
  336. */
  337. #define SafeRelease(A) [A release];A=nil;
  338. /**
  339. * SafeString
  340. */
  341. #define NewSafeString(source) (([source isKindOfClass:[NSNull class]]?@"":source) == nil?@"":(NSString*)source)
  342. /**
  343. * StringSizeWith
  344. *
  345. * @param xString 自定义字体以及字体大小
  346. * @param xFont
  347. *
  348. * @return StringSize
  349. */
  350. #define NewStringSizeWith(xString,xFont) [xString sizeWithFont:xFont]
  351. #define NewStringSize(xString,xFont) [xString sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:xFont, NSFontAttributeName, nil]]
  352. /**
  353. * Push Present
  354. */
  355. #define NewPushViewController(xClass) [self.navigationController pushViewController:xClass animated:YES] //普通push
  356. #define NewPopViewController [self.navigationController popViewControllerAnimated:YES] //普通返回到上一级
  357. #define NewPopToRootViewController [self.navigationController popToRootViewControllerAnimated:YES] //返回到最顶层
  358. #define NewPresentViewController(xClass) [self presentViewController:xClass animated:YES completion:nil] //普通present
  359. #define NewDismissViewController [self dismissViewControllerAnimated:YES completion:nil] //普通dismiss返回
  360. #define NewPresentNavigationController(xClass) [self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:xClass] animated:YES completion:nil] //带导航条的present
  361. #define NewDismissNavigationController [self.navigationController dismissViewControllerAnimated:YES completion:nil] //带导航条的dismiss返回
  362. /**
  363. * DEBUG输出日志
  364. */
  365. /*
  366. #ifdef DEBUG
  367. #define NSLog(...) NSLog(@"%s 第%d行 \n%@",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
  368. #else
  369. #define NSLog(...)
  370. #endif
  371. */
  372. /*
  373. #ifdef DEBUG
  374. #define NSLog(...) NSLog(__VA_ARGS__)
  375. #define debugMethod() NSLog(@"%s",__func__)
  376. ////
  377. #else
  378. #define NSLog(...)
  379. #define debugMethod()
  380. #endif
  381. */
  382. /*
  383. #ifdef DEBUG
  384. #define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
  385. #define LRLog(...) printf("%s: %s 第%d行: %s\n\n",[[NSString lr_stringDate] UTF8String], [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
  386. #else
  387. #define LRLog(...)
  388. #endif
  389. */
  390. /**
  391. * NSURL
  392. */
  393. #define NewURL(NewImageUrl) [NSURL URLWithString:NewImageUrl]
  394. /**
  395. * 用户默认头像
  396. */
  397. #define NewUserImage [UIImage imageNamed:@"NewDefaultHeadPortrait"]
  398. /**
  399. * 个人中心头视图
  400. */
  401. #define NewDefaultHead [UIImage imageNamed:@"NewDefaultHead"]
  402. /**
  403. * 用户未激活提示语
  404. */
  405. #define NewNoActivedTitle @"很抱歉,您的账号尚未激活!"
  406. #define NewNoActivedHUD [SVProgressHUD showInfoWithStatus:NewNoActivedTitle]
  407. /**
  408. * 默认连接服务器失败/无数据提示语
  409. */
  410. #define NewConnectServerErrorTitle @"很遗憾,网络连接失败了!"
  411. #define NewConnectServerReloadTitle @"重新加载"
  412. #define NewConnectServerNoDataTitle @"没有数据哦!"
  413. #define NewConnectServerRefreshTitle @"刷新"
  414. #define NewConnectServerNoMoreDataTitle @"数据已经加载完毕"
  415. /**
  416. * 默认网络错误图片
  417. */
  418. #define NewetworkErrorImage @"NewNetworkError"
  419. /**
  420. * 默认无网络数据图片
  421. */
  422. #define NewNoDataErrorImage @"消息为空"
  423. /**
  424. * 默认无视频图片
  425. */
  426. #define NewNoVideoErrorImage @"NewNoVideoError"
  427. /**
  428. * 默认的加载失败之后呈现的图片
  429. */
  430. #define NewImageError_J [UIImage imageNamed:@"imageError_J"] //正
  431. #define NewImageError_T [UIImage imageNamed:@"imageError_T"] //横
  432. #define NewImageError_V [UIImage imageNamed:@"imageError_V"] //竖
  433. #define NewImageError_C [UIImage imageNamed:@"imageError_C"] //圆
  434. /**
  435. * 沙盒目录文件
  436. //获取temp
  437. #define NewPathTemp NSTemporaryDirectory()
  438. //获取沙盒 Document
  439. #define NewPathDocument [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
  440. //获取沙盒 Cache
  441. #define NewPathCache [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
  442. */
  443. /**
  444. * GCD 的宏定义 使用的时候 -> xDISPATCH_ONCE_BLOCK(^{这里面写代码});
  445. //GCD - 一次性执行
  446. #define NewDISPATCH_ONCE_BLOCK(onceBlock) static dispatch_once_t onceToken; dispatch_once(&onceToken, onceBlock);
  447. //GCD - 在Main线程上运行
  448. #define NewDISPATCH_MAIN_THREAD(mainQueueBlock) dispatch_async(dispatch_get_main_queue(), mainQueueBlock);
  449. //GCD - 开启异步线程
  450. #define NewDISPATCH_GLOBAL_QUEUE_DEFAULT(globalQueueBlock) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), globalQueueBlocl);
  451. */