我有一個NSMutableArray填充類型爲「GameObject」的對象。 GameObject有許多屬性,其中之一是「gameObjectType」。 「gameObjectType」的類型是GameObjectTypeEnum。我想能夠過濾這個NSMutableArray,所以只返回某種類型的GameObjects。我有到位以下,但它給了我一個「BAD訪問」錯誤:基於枚舉屬性過濾NSMutableArray
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"gameObjectType = %@", gameObjectType];
return [gameObjects filteredArrayUsingPredicate:predicate];
是否有可能通過「自定義」類型(即,此枚舉我定義)到predicateWithFormat呼叫?
鑄造到int和使用%d給了我我需要的!謝謝。 – Marty 2010-06-13 19:29:19