画像を水平および垂直にスクロールする必要があります。
と のセクションがsegregated vertically
ありin each section itself it will be so many images which will be scrolled horizontally
ます。
Ray wenderlich チュートリアルUICollectionView
を使用して垂直スクロールを作成しましたが、各セクションで水平スクロールを取得するにはどうすればよいですか?
この目的のために、UITableView
またはのような他のオブジェクトを使用する必要がありますか?UIScrollview
これを達成するためのチュートリアルはありますか?
Is it compulsory to implement Layout subclass or UICollectionviewFlowlayout when using collection view
?
編集
これまで、垂直にスクロールし、それぞれに 5 つのセクションがあるこのコードを実装しましたが、個々のセクションをスクロールすることはできません
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section;
{
NSArray *arrayReturn = [self returnArray:section];
return arrayReturn.count;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 5;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
ImageCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"imagecell" forIndexPath:indexPath];
NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
NSArray *arrSection = [NSArray arrayWithArray:[self returnArray:indexPath.section]];
NSString *fileName = [arrSection objectAtIndex:indexPath.row];
UIImage *image = [UIImage imageNamed:fileName];
dispatch_async(dispatch_get_main_queue(), ^{
// cell.imgVw.image = ;
if([CollectionView.indexPathsForVisibleItems containsObject:indexPath]){
ImageCell *currentCell = (ImageCell *) [cv cellForItemAtIndexPath:indexPath];
currentCell.imgVw.image = image;
}
});
}];
[self.thumbnailQueue addOperation:operation];
return cell;
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
HeaderView *Header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"PhotoHeaderView" forIndexPath:indexPath];
Header.lblHeaderTitle.text = @"Header title";
Header.backgroundColor = [UIColor yellowColor];
return Header;
}