私は、uitableviewcellの中に埋め込まれたuicollectionviewセルを持っています。 uicollectionviewのデータソースとデリゲートは、TableviewControllerに接続されています。私は各テーブルビューのセルでコレクションビューを設定する方法を理解できないようです。ここに私のTableviewController内のコードは次のとおりです。UitableviewCellの内部にUICollectionViewCellを設定する方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
// Configure the cell...
return cell;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"item" forIndexPath:indexPath];
// Configure the cell
return cell;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of items
return 13;
}
私が思ったことはそうですが、どうしたらいいですか? collectionviewの 'cellForItemIndexPath'はどこに実装されるのでしょうか? –
これはあなたの 'UITableViewCell'サブクラスの内部で実装されます。返事が遅くなってごめん。 –