Creating a two dimensional array in Objective-C

后端 未结 6 509
Happy的楠姐
Happy的楠姐 2020-12-01 09:46

Whats the easiest way to declare a two dimensional array in Objective-C? I am reading an matrix of numbers from a text file from a website and want to take the data and pla

6条回答
  •  遥遥无期
    2020-12-01 09:56

    This will also work:

        NSArray *myArray = @[
                                @[ @1, @2, @3, @4],
                                @[ @1, @2, @3, @4],
                                @[ @1, @2, @3, @4],
                                @[ @1, @2, @3, @4],
                           ];
    

    In this case it is a 4x4 array with just numbers in it.

提交回复
热议问题