写真とビデオにはImagePickerController
があります。私がカメラから写真やビデオを選ぶとき、画像としてCollectionView
に表示します。このステップではすべてが動作します。 変数checkVideo
を追加して、私がセル内の画像、ビデオまたは写真の画像を知ることができます。 checkVideo
ビデオや写真にimagePickerControllerを使用すると、値が変更されます。私はビデオから来る画像の再生アイコンを使って新しい画像を追加したい。ここに私のコードです:CollectionViewCellの2つのイメージビューを設定する方法
- (CustomCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
if (checkVideo == YES) {
UIImageView *playVideoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
playVideoImageView.image = playImg;
[cell addSubview:playVideoImageView];
cell.imageViewCell.image = arrayForImages[indexPath.row];
checkVideo = NO;
} else {
cell.imageViewCell.image = arrayForImages[indexPath.row];
}
NSLog(@"check video %@", checkVideo ? @"YES" : @"NO");
return cell;
}
ここで、この 'checkVideo'フラグを設定していますか?それは単一の変数か '配列'ですか? – Mathews