の設定はUICollectionViewIB を使用して定義され (つまり、スクロール方向: 水平など)、UITableViewCellIB を使用して埋め込まれました。
UICollectionViewCellcellディスプレイ、画像は表示されますが、忠実に 1 つずつ画像を表示するのではなく、画像を重ねて表示します。

各画像をインスタンス変数として個別に作成しましたが、メッセージ内のifステートメントとステートメントUIImageViewを使用して同じことが起こりました。switchcellForItemAtIndexPath
IBを使っていたので、バグの特定が大変かもしれませんが、コードから明らかなバグの特定にご協力いただけないでしょうか。ありがとう。
@実装 AccountTableViewCell
- (void)setSelected:(BOOL)選択アニメーション:(BOOL)アニメーション
{
[super setSelected:選択されたアニメーション:アニメーション];
// 選択した状態のビューを構成します
imageArray = @[[UIImage imageNamed:@"image1.png"], [UIImage imageNamed:@"image2.png"], [UIImage imageNamed:@"image3.png"], [UIImage imageNamed:@"image4.png" ], [UIImage imageNamed:@"image5.png"]];
self.oCollectionView.dataSource = 自己;
[self.oCollectionView setFrame:self.contentView.frame];
[self.contentView addSubview:self.oCollectionView];
self.oCollectionView.backgroundColor = [UIColor clearColor];
[self.oCollectionView reloadData];
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
1 を返します。
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
imageArray.count を返します。
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"accountCell" forIndexPath:indexPath];
UIImageView* iv = [[UIImageView alloc] init];
[cell.contentView addSubview:iv];
[iv setFrame:cell.contentView.frame];
iv.image = imageArray[indexPath.row];
セルを返します。
}
@終わり