Size of an NSArray

后端 未结 5 652
广开言路
广开言路 2021-02-01 12:48

How do you get the size of an NSArray and print it in the console using NSLog?

5条回答
  •  猫巷女王i
    2021-02-01 13:25

    Size can be determined by sending 'count' to the NSArray instance, and printing to console can be done via NSLog(), eg:

    NSArray * array = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
    NSLog(@"array size is %d", [array count]);
    

提交回复
热议问题