Account for contentInset when calculating ASScrollDirection

This commit is contained in:
Vivian Qu
2016-02-29 17:10:39 -08:00
parent 07ad27c7f6
commit d28c3c27c6

View File

@@ -622,10 +622,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (ASScrollDirection)nonFlowLayoutScrollableDirections
{
ASScrollDirection scrollableDirection = ASScrollDirectionNone;
if (self.contentSize.width > self.bounds.size.width) { // Can scroll horizontally.
if (self.contentSize.width + self.contentInset.left > self.bounds.size.width) { // Can scroll horizontally.
scrollableDirection |= ASScrollDirectionHorizontalDirections;
}
if (self.contentSize.height > self.bounds.size.height) { // Can scroll vertically.
if (self.contentSize.height + self.contentInset.top > self.bounds.size.height) { // Can scroll vertically.
scrollableDirection |= ASScrollDirectionVerticalDirections;
}
return scrollableDirection;