質問

Statically I have mentioned the number of sections for the UICollectionView as 3 as shown in the below:

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
            return 3;
    }

Now I am trying to display the second section when the application launches instead of showing the first section.As UICollectionView is a subclass of UIScrollView. I wrote the code that:

[mCollectionView scrollRectToVisible:CGRectMake(0, 600, 320, 568) animated:YES];

but it was displaying the first section only.Is there any other way to display the second section in UICollectionView.

役に立ちましたか?

解決

Try this

[collectionview scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1] atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top