iOS開(kāi)發(fā)過(guò)程中遇到的新奇玩意兒

持續(xù)更新中。。。另一篇<iOS 總結(jié)遇到的各種坑兒>

一、集合返回枚舉對(duì)象

- (NSEnumerator *)keyEnumerator {
    
    return [array objectEnumerator];
}

- (NSEnumerator *)reverseKeyEnumerator {
    
    return [array reverseObjectEnumerator];
}

以上的NSEnumerator :

官方解釋?zhuān)?NSEnumerator
 is an abstract class, instances of whose subclasses enumerate collections of other objects, such as arrays and dictionaries.
All creation methods are defined in the collection classes—such as NSArray
, NSSet
, and NSDictionary
—which provide special NSEnumerator
 objects with which to enumerate their contents. For example, NSArray
 has two methods that return an NSEnumerator
object: [objectEnumerator](apple-reference-documentation://hcQ1W7GHf_) and [reverseObjectEnumerator](apple-reference-documentation://hc41c-0oVQ). NSDictionary
also has two methods that return an NSEnumerator
 object: [keyEnumerator](apple-reference-documentation://hc-hIDsaE8) and [objectEnumerator](apple-reference-documentation://hc7rb-nJ5L). These methods let you enumerate the contents of a dictionary by key or by value, respectively.
You send [nextObject](apple-reference-documentation://hcp9Mbgcbv) repeatedly to a newly created NSEnumerator
object to have it return the next object in the original collection. When the collection is exhausted, nil
 is returned. You cannot “reset” an enumerator after it has exhausted its collection. To enumerate a collection again, you need a new enumerator.
The enumerator subclasses used by NSArray
, NSDictionary
, and NSSet
 retain the collection during enumeration. When the enumeration is exhausted, the collection is released.
**Note**In Objective-C, it is not safe to modify a mutable collection while enumerating through it. Some enumerators may currently allow enumeration of a collection that is modified, but this behavior is not guaranteed to be supported in the future.
官方解釋譯文:
NSEnumerator是一個(gè)抽象類(lèi),其子類(lèi)枚舉其他對(duì)象(如數(shù)組和字典)的集合的實(shí)例。
所有創(chuàng)建方法都在集合類(lèi)中定義,例如NSArray,NSSet和NSDictionary,它們提供用于枚舉其內(nèi)容的特殊NSEnumerator對(duì)象。例如,NSArray有兩個(gè)返回NSEnumerator對(duì)象的方法:objectEnumerator和reverseObjectEnumerator。 NSDictionary還有兩個(gè)返回NSEnumerator對(duì)象的方法:keyEnumerator和objectEnumerator。這些方法可以分別按鍵或值枚舉字典的內(nèi)容。
您將nextObject重復(fù)發(fā)送到新創(chuàng)建的NSEnumerator對(duì)象,以使其返回原始集合中的下一個(gè)對(duì)象。收集用盡時(shí),返回零。枚舉器耗盡其收集后,您無(wú)法“重置”。要再次枚舉一個(gè)集合,您需要一個(gè)新的枚舉器。
NSArray,NSDictionary和NSSet使用的枚舉子子類(lèi)在枚舉期間保留集合。枚舉耗盡時(shí),集合被釋放。
注意
在Objective-C中,通過(guò)枚舉來(lái)修改可變集合是不安全的。一些枚舉者可能現(xiàn)在允許枚舉一個(gè)被修改的集合,但這種行為不能保證在將來(lái)被支持。

二、ios字體

ios9以上 默認(rèn)字體是 蘋(píng)方字體
ios8 默認(rèn)字體是 常州華文的Heiti SC。

三、報(bào)黃提醒

define FLYRefreshDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead)

最后編輯于
?著作權(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)容

  • 很可能你的應(yīng)用是與一個(gè)支持HTTPS傳輸數(shù)據(jù)的服務(wù)器交互,但是并沒(méi)有使用TLS 1.2或更高。在這種情況下,你定義...
    Www劉閱讀 3,263評(píng)論 0 5
  • 2016.05.20 10:24 塵封已久的學(xué)習(xí)基礎(chǔ)總結(jié),最近公司項(xiàng)目不是很忙,終于抽空整理出來(lái),現(xiàn)分享出來(lái)。 1...
    si1ence閱讀 19,915評(píng)論 61 589
  • 一、概念 參考網(wǎng)頁(yè)字體Serif和Sans-serif的區(qū)別及瀏覽器字體的設(shè)置CSS Font知識(shí)整理總結(jié) 1.F...
    合肥黑閱讀 6,576評(píng)論 0 12
  • 斑鳩是重情義的鳥(niǎo),終生只有一個(gè)伴侶。翻開(kāi)《詩(shī)經(jīng)》第一篇,就是《關(guān)雎》:“關(guān)關(guān)睢鳩,在河之洲。窈窕淑女,君子好逑。”...
    素描旅行者閱讀 4,705評(píng)論 1 4
  • 前言 我是最近才開(kāi)始接觸UE4的,目前在自學(xué)這款軟件。UE4在國(guó)內(nèi)的普及范圍還不是很廣,很多時(shí)候找合適的教...
    Choi十七閱讀 410評(píng)論 0 1

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