【发布时间】:2016-06-23 10:32:51
【问题描述】:
我有一个 json 数组作为-
(
(
(
xyz,
abc,
efg,
hij
),
(
suv,
xyz,
pqr,
lmn
),
(
kmn,
mno,
"uvw",
"xt"
),
(
"pqr",
lm
)
),
)
问题是我想在上面的 json 数据数组中给出的集合中的“TableView”行中显示每个名称。这就是为什么我在“UICollectionViewCell”中使用 Tableview 作为
我就是这样做的
“GroupCollectionViewCell”内部-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TableCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text =[_groupData objectAtIndex:indexPath.row];
return cell;
}
在“ViewController.h”内-
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
GroupCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[GroupCollectionViewCell alloc] init];
// [cell.groupData addObjectsFromArray:_grouplist];
//:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
[cell loadTableData:_grouplist];
cell.delegate=self;
return cell;
}
【问题讨论】:
-
你的意思是在第一个 CollectionViewCell Excel、Outlook、CMM、下一个 Cell 的 tableView 中的 tableview 中说 SALES、MARKETING、LEGAL、COMPLIANCE?
-
你的 _groupData 有合适的值吗?
-
是的,只是这样......@AbhishekPM
-
我的 _groupData 具有与我发布的 json 数组相同的值。 @Signare
-
_groupData 的计数是多少?
标签: ios objective-c arrays uitableview uicollectionview