1

タイプのオブジェクトで高速列挙を使用したいid

基本的に私はここでチェックを逃しています:

id object = <get object form somewhere>;
if( <check if object implements fast enumeration> )
    for (id item in id<NSFastEnumeration>object)
        <process item>
4

1 に答える 1

4

このようなもの:

BOOL canBeFast = [yourCollection conformsToProtocol:@protocol(NSFastEnumeration)];
于 2011-05-23T22:18:33.707 に答える