Skip to content

Commit

Permalink
updated swift code to use bounds instead of frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Leibsly committed May 14, 2015
1 parent 48fdcaf commit 523160b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CHTCollectionViewWaterfallLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
}else{
insets = self.sectionInset
}
let width:CGFloat = self.collectionView!.frame.size.width - sectionInset.left-sectionInset.right
let width:CGFloat = self.collectionView!.bounds.size.width - sectionInset.left-sectionInset.right
let spaceColumCount:CGFloat = CGFloat(self.columnCount-1)
return floor((width - (spaceColumCount*self.minimumColumnSpacing)) / CGFloat(self.columnCount))
}
Expand Down Expand Up @@ -166,7 +166,7 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
sectionInsets = self.sectionInset
}

let width = self.collectionView!.frame.size.width - sectionInset.left - sectionInset.right
let width = self.collectionView!.bounds.size.width - sectionInset.left - sectionInset.right
let spaceColumCount = CGFloat(self.columnCount-1)
let itemWidth = floor((width - (spaceColumCount*self.minimumColumnSpacing)) / CGFloat(self.columnCount))

Expand All @@ -182,7 +182,7 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{

if heightHeader > 0 {
attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CHTCollectionElementKindSectionHeader, withIndexPath: NSIndexPath(forRow: 0, inSection: section))
attributes.frame = CGRectMake(0, top, self.collectionView!.frame.size.width, heightHeader)
attributes.frame = CGRectMake(0, top, self.collectionView!.bounds.size.width, heightHeader)
self.headersAttributes.setObject(attributes, forKey: (section))
self.allItemAttributes.addObject(attributes)

Expand Down Expand Up @@ -235,7 +235,7 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{

if footerHeight > 0 {
attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CHTCollectionElementKindSectionFooter, withIndexPath: NSIndexPath(forItem: 0, inSection: section))
attributes.frame = CGRectMake(0, top, self.collectionView!.frame.size.width, footerHeight)
attributes.frame = CGRectMake(0, top, self.collectionView!.bounds.size.width, footerHeight)
self.footersAttributes.setObject(attributes, forKey: section)
self.allItemAttributes.addObject(attributes)
top = CGRectGetMaxY(attributes.frame)
Expand Down

0 comments on commit 523160b

Please sign in to comment.