Antwort

4

ich es DateFlowLayout mit gelöst. Seltsamer Name, aber es funktioniert, mit einigen Konfigurationen.

Das war mein Setup Sie es (ich es nur für die horizontale Richtung verwendet wird):

- (void)layoutForOrientation:(UIInterfaceOrientation)orientation { 
    bool isPortrait = UIInterfaceOrientationIsPortrait(orientation); 

    self.collectionView.frame = isPortrait ? CGRectMake(0, 0, 768, 180) : CGRectMake(0, 60, 246, 595); 
    self.collectionView.collectionViewLayout = isPortrait ? DateFlowLayout.new : UICollectionViewFlowLayout.new; 
    self.flowLayout = ((UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout); 

    self.flowLayout.scrollDirection = isPortrait ? UICollectionViewScrollDirectionHorizontal : UICollectionViewScrollDirectionVertical; 
    self.flowLayout.headerReferenceSize = isPortrait ? CGSizeMake(5, 30) : CGSizeMake(246, 40); //width is margin to the left of the header - must be bigger than 0 to show headers correct. 
    self.flowLayout.minimumInteritemSpacing = isPortrait ? 10 : 0; 
    self.flowLayout.minimumLineSpacing = isPortrait ? 17 : 7; 
    self.flowLayout.sectionInset = isPortrait ? UIEdgeInsetsMake(27, 30, 25, 0) : UIEdgeInsetsMake(0, 14, 0, 0); 
    //self.flowLayout.itemSize = CGSizeMake(58, 85); //You might need this 
    self.collectionView.alwaysBounceVertical = isPortrait ? NO : YES; 
} 
+2

Hey Morten, ich weiß, ein, während es war aber irgendwelche Ideen, warum mein Kopf klebt aber nicht oben auf meine Sammlungsansicht, eher davor, in der Mitte (in der Höhe). Vielen Dank! –

+0

Ich kann nicht mit mehr Informationen sagen - für mich war es Versuch und Irrtum .. –

+0

fair genug. Ich werde ein bisschen mehr davon auch tun! zumindest weiß ich, dass es möglich ist :) –

Verwandte Themen