Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在单个UITableVIewCell中显示json数组值_Ios_Uitableview - Fatal编程技术网

Ios 如何在单个UITableVIewCell中显示json数组值

Ios 如何在单个UITableVIewCell中显示json数组值,ios,uitableview,Ios,Uitableview,如何在单个UITableVIewCell my数组中显示json数组值: Barbell, "EZ Bar", Dumbbell, Rope, "Resistance Bands", Machine, Cable, Kettlebell, "Body Weight" UITableVIew numberOfRowsInSection中的给定我的数组计数。当我显示这些数组时。它显示每一个细胞一买一。但是我需要在一个单元格中显示所有的值 在单元格中,我想显示三个值,如本例所示 [Barbell

如何在单个UITableVIewCell my数组中显示json数组值:

Barbell, "EZ Bar", Dumbbell, Rope, "Resistance Bands", Machine, Cable, Kettlebell, "Body Weight" 
UITableVIew numberOfRowsInSection中的给定我的数组计数。当我显示这些数组时。它显示每一个细胞一买一。但是我需要在一个单元格中显示所有的值

在单元格中,我想显示三个值,如本例所示


[Barbell EZ bar Dumbbell],然后是下一个值。请告诉我怎么做。我是开发新手。

使用下面的代码添加字符串,无论您想使用什么来加入组件:

如果您想通过
空格“

如果您想通过
逗号“,”

选中此项:

然后,您可以使用:

在接口文件中:

@property (strong, nonatomic) NSArray *splittedArray;
在实现文件中:

    NSArray *items = [[NSArray alloc] initWithObjects:@"Barbell", @"EZ Bar", @"Dumbbell", @"Rope", "Resistance Bands", @"Machine", @"Cable", @"Kettlebell", @"Body Weight", nil];

    splittedArray = [NSArray splitArray:items componentsPerSegment:3]
然后使用cellForRowAtIndexPath中splittedarray的每个内容

例如:

[self.splittedArray objectAtIndex:indexPath.row]

一些对你有帮助的教程:和
    NSArray *items = [[NSArray alloc] initWithObjects:@"Barbell", @"EZ Bar", @"Dumbbell", @"Rope", "Resistance Bands", @"Machine", @"Cable", @"Kettlebell", @"Body Weight", nil];

    splittedArray = [NSArray splitArray:items componentsPerSegment:3]
[self.splittedArray objectAtIndex:indexPath.row]