apploft / APLExpandableCollectionView

UICollectionView subclass with vertically expandable and collapsible sections
MIT License
110 stars 14 forks source link

sizeForItemAtIndexPath not works #21

Open sphairo opened 6 years ago

sphairo commented 6 years ago

in objective-c

not works

in swift:

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {

    return CGSize(width: self.view.frame.size.width, height: 120)
}

not works :(

only i can change size item with this code:

let layout:APLExpandableSectionFlowLayout = self.collectionView.collectionViewLayout as! APLExpandableSectionFlowLayout layout.itemSize = CGSizeMake(self.view.frame.size.width, 120); layout.minimumLineSpacing = 4 layout.scrollDirection = .Vertical layout.sectionInset = UIEdgeInsetsMake(8, 8, 0, 8);

but i need to do by NSIndexPath

michaelkamphausen commented 6 years ago

Correct. This library works only for CollectionViews where every cell has the same size. See #5.