PCH文件

pch文件
作用:程序在運(yùn)行之前首先讀取文件中的代碼,可以在該文件中定義一些整個(gè)工程d都可以直接讀取的符號(hào)

#ifndef Music_pch
#define Music_pch

// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.

#define SCR_W [UIScreen mainScreen].bounds.size.width
#define SCR_H [UIScreen mainScreen].bounds.size.height

//判斷是否是3.5寸屏(320px *480px)

#define SCR_3_5 (SCR_W==320&&SCR_H==480)

//判斷是否是4寸屏(640px *1136px)

#define SCR_4 (SCR_W==320&&SCR_H==568)

//判斷是否是4.7寸屏(750px *1334px)

#define SCR_4_7 (SCR_W==375&&SCR_H==667)

//判斷是否是5.5寸屏(1242px *2196px)

#define SCR_5_5 (SCR_W==414&&SCR_H==736)

//判斷是否是 X  寸屏(1125px *2436px)

#define SCR_X (SCR_W==375&&SCR_H==812)

//判斷是否是X_R寸屏(320px *480px)

#define SCR_X_R (SCR_W==414&&SCR_H==896)

//判斷是否是X_Max寸屏(1242px *2688px)

#define SCR_X_Max (SCR_w==414&&SCR_H==896)

//狀態(tài)欄高度

#define StatusBarHeight (SCR_H<=736?20:44)

//導(dǎo)航條高度

#define NavigationItemHeight 44.0

//頂部高度

#define TopBarHeight (StatusBarHeight+NavigationItemHeight)


#endif /* Music_pch */
 
添加步驟:
        新建Pch文件 工程設(shè)置-BuildSetting-Prefix Header -¥(SRCROOT)/工程名稱(chēng)/pch文件全稱(chēng)
屏幕快照 2018-11-16 上午11.48.47.png

[圖片上傳中...(屏幕快照 2018-11-16 上午11.48.28.png-b6301f-1542353480895-0)]

屏幕快照 2018-11-16 上午11.49.25.png
屏幕快照 2018-11-16 上午11.49.33.png
屏幕快照 2018-11-16 上午11.49.52.png
屏幕快照 2018-11-16 上午11.51.50.png
屏幕快照 2018-11-16 上午11.57.39.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容