开发中省代码的宏

//  Created by liuhengyu on 2021/3/18.

//  Copyright © 2021 liuhengyu. All rights reserved.

//  屏幕宽

#define Screen_Width [UIScreen mainScreen].bounds.size.width

//  屏幕高

#define Screen_Height [UIScreen mainScreen].bounds.size.height

//  导航高度

#define SafeAreaTopHeight    (Screen_Height >= 812.0 ? 88 : 64)

//  底部是否有圆角

#define SafeAreaBottomHeight (Screen_Height >= 812.0 ? 34 : 0)

/**

*  iPhone4 or iPhone4s

*/

#define  iPhone4_4s     (Width == 320.f && Height == 480.f ? YES : NO)

/**

*  iPhone5 or iPhone5s

*/

#define  iPhone5_5s     (Width == 320.f && Height == 568.f ? YES : NO)

/**

*  iPhone6 or iPhone6s

*/

#define  iPhone6_6s     (Width == 375.f && Height == 667.f ? YES : NO)

/**

*  iPhone6Plus or iPhone6sPlus

*/

#define  iPhone6_6sPlus (Width == 414.f && Height == 736.f ? YES : NO)

/**

*  iPhoneX

*/

#define  iPhoneX_Xs_XR_XsMax (Width >= 375.f && Height >= 812.f ? YES : NO)

/**

*  Status bar height.

*/

#define  StatusBarHeight                 (iPhoneX_Xs_XR_XsMax ? 44.f : 20.f)

/**

*  Status bar height.

*/

#define  Status_LHY_BarHeight                 (iPhoneX_Xs_XR_XsMax ? 44.f : 0.f)

/**

*  Navigation bar height.

*/

#define  NavigationBarHeight             44.f

/**

*  Status bar & navigation bar height.

*/

#define  StatusBarAndNavigationBarHeight (iPhoneX_Xs_XR_XsMax ? (44.f + 44.f) : (20.f + 44.f))

/**

*  Tabbar height.

*/

#define  TabbarHeight                    (iPhoneX_Xs_XR_XsMax ? (34.f + 49.f) : 49.f)

/**

*  Tabbar 下线到底部的安全距离.

*/

#define  TabbarSafeAreaHeight            (iPhoneX_Xs_XR_XsMax ? 34.f : 0.f)

/**

*  宽比例

*/

#define Scale_Width  Width / 375.f

/**

*  高比例

*/

#define Scale_Height Height/(iPhoneX_Xs_XR_XsMax ? 812.0 : 667)

/**

*  Tabbar 按钮文字偏移距离

*/

#define Bottom_button_Scale UIEdgeInsetsMake(-TabbarSafeAreaHeight / 2, 0, TabbarSafeAreaHeight / 2, 0);

#pragma mark - 颜色宏

//  颜色

#define SuTuColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

#define SuTuColorAlpha(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

#define UIColorFromRGB(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]

//  本地数据存储地址

#define OADAccountInfoFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"accountInfo.data"]

//  本地数据存储地址

#define RemindSetUpInfoFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"addShopingModelArr.data"]

//播放列表数据

#define AudioListInfoFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"audioList.data"]

//当前播放数据

#define AudioInfoFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"audio.data"]

//当前广告数据

#define AdvertisingFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"advertising.data"]

//当前下载列表

#define dowmloadListFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"arrayXML.xml"]

// 缓存主目录

#define HSCachesDirectory [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"HSCache"]

// 保存文件名

#define HBFirstName(url)  url.md5String

#define HSFileName(url,phoneStr) [NSString stringWithFormat:@"%@.%@.%@",phoneStr,HBFirstName(url),@"mp3"]

// 文件的存放路径(caches)

#define HSFileFullpath(url,phoneStr) [HSCachesDirectory stringByAppendingPathComponent:HSFileName(url,phoneStr)]

// 文件的已下载长度

#define HSDownloadLength(url,phoneStr) [[[NSFileManager defaultManager] attributesOfItemAtPath:HSFileFullpath(url,phoneStr) error:nil][NSFileSize] integerValue]

// 存储文件总长度的文件路径(caches)

#define HSTotalLengthFullpath [HSCachesDirectory stringByAppendingPathComponent:@"totalLength.plist"]

#define HUDSHOW(String)    [MBProgressHUD showMessageTitle:String afterDelay:1.2f];

#define HUDLOADING(String) [MBProgressHUD showMessage:String];

#define HUDDISSMISS        [MBProgressHUD hideHUD];

#define WEAKSELF typeof(self) __weak weakSelf = self;

#define STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf;

//#ifdef __IPHONE_13_0

//

//#define Window   [UIApplication sharedApplication].windows[0]

//#else

//#define Window  [[UIApplication sharedApplication] keyWindow]

//

//#endif

#define Window (([[[UIDevice currentDevice] systemVersion] floatValue]>=13.0)?[[UIApplication sharedApplication] keyWindow]:[[[UIApplication sharedApplication] delegate] window])

#define SuTuLog(s, ... ) NSLog(@"[%@ in line %d] ===============>%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )

//MARK:        -------------px转换

#define kPxChange(pxSize) ((pxSize)*(72.f)/(96.f))

#pragma mark - 字体宏

#define FontSemibold(a) [UIFont fontWithName:@"PingFangSC-Semibold" size:a*Scale_Width]

#define FontMedium(a) [UIFont fontWithName:@"PingFang-SC-Medium" size:a*Scale_Width]

#define FontRegular(a) [UIFont fontWithName:@"PingFang-SC-Regular" size:a*Scale_Width]

#endif /* PrefixHeader_pch */

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值