0

私は現在、UICollectionViewCells の 2 列である UICollectionView を持っています。セルを画面の全幅に拡張し、他のセルを下に移動させる方法を誰かが決定したかどうか疑問に思っています。セルのフレームサイズと行をいじろうとしましたが、何も正しく動作していないようです。何か案は?

4

2 に答える 2

1

このようなものはあなたのために働きますか:

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    self.path = indexPath;
    [self.collectionView reloadData];
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if ([indexPath isEqual:self.path]) {
        return CGSizeMake(320, 150);
    }else{
        return CGSizeMake(150, 150);
    }
}
于 2013-07-30T00:41:11.013 に答える
0

2 つの UICollectionViewLayouts が必要です。2 番目の UICollectionViewLayout で itemSize を変更します。setCollectionViewLayout:animated次に、2 つのコレクション ビュー レイアウト間の変更をアニメーション化する which を呼び出すことができます。

于 2013-07-30T00:41:02.907 に答える