宏的定義:
#define BookContentContainerViewCornerRadius 4.0
#define BookContentContainerViewCornerRadius @"yushuyi"
在宏裏面同樣可以執行代碼:
#define BookContentContainerViewCornerRadius 1+1
使用宏編寫IF ELSE 語句語法:
#if YES
//Code
#else
//Code
#endif
1:UI_USER_INTERFACE_IDIOM()
功能:判斷運行當前應用的設備是iPhone 還是 iPad
返回: UIUserInterfaceIdiom 枚舉值
2: TARGET_IPHONE_SIMULATOR
功能:判斷當前運行環境是否是模擬器
返回:YES 表示 是模擬器, NO表示不是模擬器