私はIOSで新しく、2D配列をどのように埋め込むのかはわかりませんcollectionView
2D NSMutableArray in UICollectionView
**ラベルを使用して、コレクションビューで次のように表示する方法を教えてください。
myArray[0]->1,2,3,4,5
myArray[1]->6,7,8,9
myArray[2]->10,11,12,15
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
// What to call here as this is 2D?
return self.myArray.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
NSString *simpleId= @"CollectionViewCell";
TableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:simpleId forIndexPath:indexPath];
//What to write here ? Cell contain 1 Label
}
私は推測します: 'collectionView:numberOfItemsInSection:' 'return [[self.myArray objectAtIndex:section] count];'、 'numberOfSection':' return [self.myArray count] '、コレクションビュー:cellForRowAtIndexPath: ':' NSString * item = [[self.myArray objectAtIndexPath:[indexPath section] objectAtIndex:[indexPath row]]; '? – Larme
[[self.myArray objectAtIndex:section] count]; これは、 "制御が非void関数に戻ります"というエラーを返します。 –
@SyedMunimRazaようこそstackoverflowへと私の下の答えを確認してください..これはあなたの問題を解決するのに役立つことを願っています。 –