筆記。
//
// LHQPch.pch
// LHQProgressHUD
//
// Created by Hq.Lin on 2017/11/23.
// Copyright ? 2017年 lin. All rights reserved.
//
#ifndef LHQPch_pch
#define LHQPch_pch
//獲取屏幕寬高
#define LHQSCREEN_W [[UIScreen mainScreen]bounds].size.width
#define LHQSCREEN_H [[UIScreen mainScreen]bounds].size.height
#define LHQSCREEN_BOUNDS [UIScreen mainScreen].bounds
#define LHQSCREEN_BOUNDS_SIZE [UIScreen mainScreen].bounds.size
//狀態(tài)欄高度
#define LHQStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height//iphoneX 高44pt 其他20pt
//導(dǎo)航欄高度
#define LHQNavBarHeight 44.0
//tabBar高度
#define LHQTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)//iphoneX 底部高34pt (+49pt = 83pt)
//導(dǎo)航欄高度 + 狀態(tài)欄高度
#define LHQTopHeight (LHQStatusBarHeight + LHQNavBarHeight)
//不同屏幕尺寸字體適配
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_PAD (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad)
#define KStandardW (IS_IPHONE ? 375 : 768)
#define KStandardH (IS_IPHONE ? 667 : 1024)
#define kScreenWidthRatio (UIScreen.mainScreen.bounds.size.width / KStandardW)
#define kScreenHeightRatio (UIScreen.mainScreen.bounds.size.height / KStandardH)
#define AdaptedWidth(x) ceilf((x) * kScreenWidthRatio)
#define AdaptedHeight(x) ceilf((x) * kScreenHeightRatio)
#define AdaptedFontSize(R) [UIFont systemFontOfSize:AdaptedWidth(R)]
//強(qiáng)弱引用
#define LHQWeakSelf(type)__weak typeof(type)weak##type = type;
#define LHQStrongSelf(type)__strong typeof(type)type = weak##type;
//DEBUG模式下打印日志,當(dāng)前行
#ifdef DEBUG
#define DLog(fmt,...)NSLog((@"%s[Line %d]" fmt),__PRETTY_FUNCTION__,__LINE__,##__VA_ARGS__);
#else
#define DLog(...)
#endif
//定義UIImage對(duì)象
#define ImageWithFile(_pointer) [UIImage imageWithContentsOfFile:([[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"%@@%dx",_pointer,(int)[UIScreen mainScreen].nativeScale]ofType:@"png"])]
#define IMAGE_NAMED(name) [UIImage imageNamed:name]
//字體
#define BOLDSYSTEMFONT(FONTSIZE) [UIFont boldSystemFontOfSize:FONTSIZE]
#define SYSTEMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE]
#define FONT(NAME,FONTSIZE) [UIFont fontWithName:(NAME)size:(FONTSIZE)]
//方正黑體簡(jiǎn)體字體定義
#define FONT_ISNAME(F) [UIFont fontWithName:@"FZHTJW--GB1-0" size:F]
//顏色
// 隨機(jī)色 透明度
#define LHQRandomColorWithAlpha(a) [UIColor colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:(a)]
// 自定義顏色 透明度
#define LHQColorWithAlpha(r, g, b, a) [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:a]
//16進(jìn)制顏色
#define COLOR_WITH_HEX(hexValue) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16)) / 255.0 green:((float)((hexValue & 0xFF00) >> 8)) / 255.0 blue:((float)(hexValue & 0xFF)) / 255.0 alpha:1.0f]
//NSUserDefaults 實(shí)例化
#define UserDefaults [NSUserDefaults standardUserDefaults]
#endif /* LHQPch_pch */