objective-c - 我将如何输出这个字符串数组?

标签 objective-c arrays string

假设我有一个字符串数组...

[NSArray arrayWithObjects: @"red", @"blue", @"green", @"yellow", nil]

我如何实现这样的输出...?

red is a color
blue is a color
green is a color
yellow is a color

谢谢!

最佳答案

NSArray *colors = ...;
for (NSString *color in colors) {
  NSLog(@"%@ is a color", color);
}

关于objective-c - 我将如何输出这个字符串数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5589901/

相关文章:

iphone - GPUImageFilter 的多次分配导致应用程序崩溃

javascript - 为 javascript 国家选择器优化 map 的使用

Java 字节数组到字符串到字节数组

c - 在 C 运行时输入一个特殊的字符串

c# - 到处查找枚举转换为字符串

iphone - iOS NSSet/NSArray/NSDictionary 可以有多大?

ios - 如何从另一个类访问实例

c - 打印二维数组

c# - C# 中的 DataTable 与 Array 性能

ios - Obj-C 中的委托(delegate)模式 - 我做错了吗?