objective c - Array of NSStrings size 100 -
working on app needs have array of nsstrings board. first need method initialize nsarray of size 100 , build methods add together random chutes , ladders across board. makechutes/ladders methods take parameters of how many spaces moved. problem i'm having initializing array of nsstrings, know can utilize non-mutable nsarray mutable objects i'm having problem syntax.
basically want initialize this:
[nsarray arraywithobjects: @"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", nil]
but 100 strings , in form of method so:
-(id)initboard{ for(int =0; i<100;i++){ _board[i] = @"| |"; } }
try
-(id)initboard { nsmutablearray *mutablearray = [nsmutablearray arraywithcapacity:100]; (int = 0; < 100; i++) { [mutablearray addobject:@"| |"]; } _board = mutablearray; }
objective-c
No comments:
Post a Comment