Ale*_*dro -1 xcode objective-c nsmutablearray ios
我有一个NSMutableArray.当我使用时NSLog,这是输出:
2012-12-15 17:58:28.849 Splash-it[504:907] (
"Open House New York",
"Boston Athletic Association",
"Autofest Tanzania"
),
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到NSString这些标题中的一个(考虑到标题会改变,我想我需要使用objectAtIndex但我不认为它会在这种情况下起作用)?
例如
NSString = @"Boston Athletic Association"
Run Code Online (Sandbox Code Playgroud)
这objectAtIndex与可变阵列完美配合.因此,使用从零开始的索引来获取数组中的第二个对象,您将执行以下操作:
NSString *string = [array objectAtIndex:1];
Run Code Online (Sandbox Code Playgroud)
使用较新版本的Xcode,您还可以使用以下语法:
NSString *string = array[1];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4195 次 |
| 最近记录: |