0
我正在構建一款iphone遊戲。我有一套NSStrings,我在整個遊戲生命週期中定期設置。我發現我需要經常設置相同的NSString,並且通過NSStrings數組循環可以檢查NSString atIndex:i的值,但是使用相同的方法設置它們不會導致任何結果。基本上我有一套下面的變量,我想設置在一個循環中。有人能告訴我如何重新編寫以下爲一個循環,將正確設置NSString的?:動態設置循環中的NSString vars
//復位狀態,首先
square_01State = @"first";
square_02State = @"first";
square_03State = @"first";
square_04State = @"first";
square_05State = @"first";
square_06State = @"first";
square_07State = @"first";
square_08State = @"first";
square_09State = @"first";
square_10State = @"first";
square_11State = @"first";
square_12State = @"first";
square_13State = @"first";
square_14State = @"first";
square_15State = @"first";
square_16State = @"first";
有可能是數百這些,所以我d喜歡能夠將它們全部設置爲循環。謝謝,
因此,數組索引應該只保存@「first」,而不是實際的NSString對象?咄!我現在明白了。我在我的手肘... 謝謝 - 這就是爲什麼我問,4隻眼睛比2好:) – Damonmath 2010-07-05 01:13:26