iOS - F - 格式化

1. 格式化輸出:NSLog(@"");

%@ ? ? 對象

%d, %i 整數(shù)

%u ? ? 無符整形

%f ? ? 浮點(diǎn)/雙字

%x, %X 二進(jìn)制整數(shù)

%o ? ? 八進(jìn)制整數(shù)

%zu ? ?size_t

%p ? ? 指針

%e ? ? 浮點(diǎn)/雙字 (科學(xué)計算)

%g ? ? 浮點(diǎn)/雙字

%s ? ? C 字符串

%.*s ? Pascal字符串

%c ? ? 字符

%C ? ? unichar

%lld ? 64位長整數(shù)(long long)

%llu ? 無符64位長整數(shù)

%Lf ? ?64位雙字

%e 是實(shí)數(shù),用科學(xué)計數(shù)法計的

2. 類屬性的 attribute

/// Defines a property attribute

typedef struct {

? ? const char * _Nonnull name;???????? /**< The name of the attribute */

? ? const char * _Nonnull value;? ? ? ? ? /**< The value of the attribute (usually empty) */

} objc_property_attribute_t;


unsigned int outCount = 0; ? ?

objc_property_t *propertyList = class_copyPropertyList([UIView class], &outCount); ? ?

for (int i = 0; i < outCount; i++) { ? ? ? ?

const char *name = property_getName(propertyList[i]); ? ? ? ?

const char *attribute = property_getAttributes(propertyList[i]); ? ? ? ?

NSLog(@"\nname = %s\nattribute = %s\n", name, attribute); ? ?

}


name = _mapkit_doubleFrame

attribute = T{CGRect={CGPoint=dd}{CGSize=dd}},R,N

name = monitorsSubtree

attribute = TB,N,G_monitorsSubtree,S_setMonitorsSubtree:


字母???? | OC? ? ? ? ? ? | 含義

------????|---------------????????|---

? 有R | readonly? ? ? ? ? ? ?| 只讀

? 無R | readwrite? ? ????????| 讀寫

? 有N | nonatomic? ? ? ? ? | 線程不安全

? 無N | atomic? ? ? ? ????????| 線程安全

? C? ? | copy? ? ? ? ? ? ? ? ? ?| 復(fù)制

? &? ? | strong/retain? ? ? ?| 強(qiáng)引用

? W? ?| weak? ? ? ? ? ????????| 弱引用

Sxxx: | setter? ? ? ? ????????| set方法

?Gxxx | getter? ? ? ? ? ? ? ?| get方法

?Vxxx | var? ? ? ? ? ? ? ? ? ?| 實(shí)例變量

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

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

  • 轉(zhuǎn)至元數(shù)據(jù)結(jié)尾創(chuàng)建: 董瀟偉,最新修改于: 十二月 23, 2016 轉(zhuǎn)至元數(shù)據(jù)起始第一章:isa和Class一....
    40c0490e5268閱讀 2,082評論 0 9
  • 我們常常會聽說 Objective-C 是一門動態(tài)語言,那么這個「動態(tài)」表現(xiàn)在哪呢?我想最主要的表現(xiàn)就是 Obje...
    Ethan_Struggle閱讀 2,349評論 0 7
  • Objective-C語言是一門動態(tài)語言,它將很多靜態(tài)語言在編譯和鏈接時期做的事放到了運(yùn)行時來處理。這種動態(tài)語言的...
    有一種再見叫青春閱讀 681評論 0 3
  • Objective-C語言是一門動態(tài)語言,他將很多靜態(tài)語言在編譯和鏈接時期做的事情放到了運(yùn)行時來處理。這種動態(tài)語言...
    tigger丨閱讀 1,602評論 0 8
  • 每年總喜歡自己有一些變化,能跳出舒適區(qū)。2018年1月7日-2月7日,我想要向宇宙一個月的和平。不抱怨,不糾纏于負(fù)...
    水精靈兒閱讀 397評論 0 0

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