pch 文件路徑 build settings 搜索Prifixheader
$(SRCROOT)/黃色的文件夾名/黃色文件夾名/一層一層直到PCH文件名.pch
!3暮帷!? 文件層要統(tǒng)一 工程里的文件夾包含關(guān)系要和Finder 里的一致
常用宏定義
顏色
#define kRGBColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
設(shè)施控件圓角
#definekViewRadius(View,Radius)\\[View.layer setCornerRadius:(Radius)];\[View.layer setMasksToBounds:YES]
設(shè)施圓角? 邊框線寬度 顏色
#definekViewBorderRadius(View,Radius,Width,Color)\\[View.layer setCornerRadius:(Radius)];\[View.layer setMasksToBounds:YES];\[View.layer setBorderWidth:(Width)];\[View.layer setBorderColor:[Color CGColor]]
歸檔
#definekUserDefaults [NSUserDefaults standardUserDefaults]
屏幕長(zhǎng)寬
#definekScreenWidth[UIScreen mainScreen].bounds.size.width#definekScreenHeight[UIScreen mainScreen].bounds.size.height
通知
#definekNoteCenter [NSNotificationCenter defaultCenter]
// 弱引用
#definekWeakSelf __weak typeof(self) weakSelf = self
/*Dubug相關(guān)/
#ifdefDEBUG#defineNSLog(...) NSLog(__VA_ARGS__)#definedebugMethod() NSLog(@"%s", __func__)#else#defineNSLog(...)#definedebugMethod()#endif#ifdefDEBUG#defineWSLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )//分別是方法地址遥诉,文件名悉尾,在文件的第幾行,自定義輸出內(nèi)容#else#define**Log( s, ... )#endif
//不同屏幕尺寸字體適配#definekScreenWidthRatio? (UIScreen.mainScreen.bounds.size.width / 375.0)#definekScreenHeightRatio (UIScreen.mainScreen.bounds.size.height / 667.0)#defineAdaptedWidth(x)? ceilf((x) * kScreenWidthRatio)#defineAdaptedHeight(x) ceilf((x) * kScreenHeightRatio)#defineAdaptedFontSize(R)? ? [UIFont systemFontOfSize:AdaptedWidth(R)]