ui尺寸
類的巨集
log日誌
列印
判斷裝置?系統?
判斷當前的iphone裝置/系統版本
定義乙個define函式
#define tt_release_cf_safely(__ref) }
#if __has_feature(objc_arc)
//compiling with arc
#else
// compiling without arc
#endif
#pragma mark - common functions
#define release_safely(__pointer)
#define safe_delete(p) if(p)
#define safe_release(x) [x release];x=nil
方正黑體簡體字體定義
#define font(f) [uifont fontwithname:@"fzhtjw--gb1-0" size:f]
**相關
設定view的tag屬性
#define viewwithtag(_object, _tag) [_object viewwithtag : _tag]
語言/國際化相關
執行緒 g-c-d
#define back(block) dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), block)
#define main(block) dispatch_async(dispatch_get_main_queue(),block)
沙盒目錄檔案
//獲取temp
#define kpathtemp nstemporarydirectory()
//獲取沙盒 document
#define kpathdocument [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject]
//獲取沙盒 cache
#define kpathcache [nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmask, yes) firstobject]
nsuserdefaults 例項化
#define user_default [nsuserdefaults standarduserdefaults]
由角度獲取弧度 ,由弧度獲取角度
#define degreestoradian(x) (m_pi * (x) / 180.0)
#define radiantodegrees(radian) (radian*180.0)/(m_pi)
單例化乙個類
#define synthesize_singleton_for_class(classname) \
\static classname *shared##classname = nil; \
\+ (classname *)shared##classname \
\} \
\return shared##classname; \
} \\
+ (id)allocwithzone:(nszone *)zone \
\} \
\return nil; \
} \\
- (id)copywithzone:(nszone *)zone \
iOS開發中常用到的巨集定義
字串是否為空 define kstringisempty str str iskindofclass nsnull class str nil str length 1 yes no 陣列是否為空 define karrayisempty array array nil array iskindof...
iOS 開發中常用的巨集有那些
ui尺寸類的巨集 log日誌列印 判斷裝置?系統?判斷當前的iphone裝置 系統版本 定義乙個define函式 define tt release cf safely ref if has feature objc arc compiling with arc else compiling wit...
IOS開發常用巨集
字串是否為空 define kstringisempty str str iskindofclass nsnull class str nil str length 1 yes no 陣列是否為空 define karrayisempty array array nil array iskindof...