Permalink
Browse files

remove whitespace

  • Loading branch information...
1 parent 8c83264 commit d87fff843d9d3d6f2fbdabce7a23f565b0a7f053 @steipete steipete committed Jul 30, 2013
@@ -110,7 +110,7 @@ @interface PSTCollectionView () <UIScrollViewDelegate> {
unsigned int doneFirstLayout : 1;
}_collectionViewFlags;
CGPoint _lastLayoutOffset;
- char filler[200]; // [HACK] Our class needs to be larger than Apple's class for the superclass change to work
+ char filler[200]; // [HACK] Our class needs to be larged than Apple's class for the superclass change to work
}
@property (nonatomic, strong) PSTCollectionViewData *collectionViewData;
@property (nonatomic, strong, readonly) PSTCollectionViewExt *extVars;
@@ -1302,39 +1302,39 @@ - (void)setCollectionViewLayout:(PSTCollectionViewLayout *)layout {
- (void)setDelegate:(id<PSTCollectionViewDelegate>)delegate {
self.extVars.collectionViewDelegate = delegate;
- // Managing the Selected Cells
+ // Managing the Selected Cells
_collectionViewFlags.delegateShouldSelectItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:shouldSelectItemAtIndexPath:)];
_collectionViewFlags.delegateDidSelectItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:didSelectItemAtIndexPath:)];
_collectionViewFlags.delegateShouldDeselectItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:shouldDeselectItemAtIndexPath:)];
_collectionViewFlags.delegateDidDeselectItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:didDeselectItemAtIndexPath:)];
- // Managing Cell Highlighting
+ // Managing Cell Highlighting
_collectionViewFlags.delegateShouldHighlightItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:shouldHighlightItemAtIndexPath:)];
_collectionViewFlags.delegateDidHighlightItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:didHighlightItemAtIndexPath:)];
_collectionViewFlags.delegateDidUnhighlightItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:didUnhighlightItemAtIndexPath:)];
- // Tracking the Removal of Views
+ // Tracking the Removal of Views
_collectionViewFlags.delegateDidEndDisplayingCell = [self.delegate respondsToSelector:@selector(collectionView:didEndDisplayingCell:forItemAtIndexPath:)];
_collectionViewFlags.delegateDidEndDisplayingSupplementaryView = [self.delegate respondsToSelector:@selector(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)];
- // Managing Actions for Cells
+ // Managing Actions for Cells
_collectionViewFlags.delegateSupportsMenus = [self.delegate respondsToSelector:@selector(collectionView:shouldShowMenuForItemAtIndexPath:)];
// These aren't present in the flags which is a little strange. Not adding them because that will mess with byte alignment which will affect cross compatibility.
// The flag names are guesses and are there for documentation purposes.
- // _collectionViewFlags.delegateCanPerformActionForItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:canPerformAction:forItemAtIndexPath:withSender:)];
- // _collectionViewFlags.delegatePerformActionForItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:performAction:forItemAtIndexPath:withSender:)];
+ // _collectionViewFlags.delegateCanPerformActionForItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:canPerformAction:forItemAtIndexPath:withSender:)];
+ // _collectionViewFlags.delegatePerformActionForItemAtIndexPath = [self.delegate respondsToSelector:@selector(collectionView:performAction:forItemAtIndexPath:withSender:)];
}
// Might be overkill since two are required and two are handled by PSTCollectionViewData leaving only one flag we actually need to check for
- (void)setDataSource:(id<PSTCollectionViewDataSource>)dataSource {
if (dataSource != _dataSource) {
_dataSource = dataSource;
- // Getting Item and Section Metrics
+ // Getting Item and Section Metrics
_collectionViewFlags.dataSourceNumberOfSections = [_dataSource respondsToSelector:@selector(numberOfSectionsInCollectionView:)];
- // Getting Views for Items
+ // Getting Views for Items
_collectionViewFlags.dataSourceViewForSupplementaryElement = [_dataSource respondsToSelector:@selector(collectionView:viewForSupplementaryElementOfKind:atIndexPath:)];
}
}
@@ -2229,7 +2229,7 @@ @implementation PSUICollectionViewController_ @end
static BOOL PSTRegisterClass(NSString *UIClassName, Class PSTClass) {
NSCParameterAssert(UIClassName);
NSCParameterAssert(PSTClass);
-
+
Class UIClass = NSClassFromString(UIClassName);
if (UIClass) {
// Class size need to be the same for class_setSuperclass to work.
@@ -106,14 +106,14 @@ - (NSInteger)numberOfItems {
- (NSInteger)numberOfItemsBeforeSection:(NSInteger)section {
[self validateItemCounts];
-
+
NSAssert(section < _numSections, @"request for number of items in section %d when there are only %d sections in the collection view", section, _numSections);
-
+
NSInteger returnCount = 0;
for (int i = 0; i < section; i++) {
returnCount += _sectionItemCounts[i];
}
-
+
return returnCount;
}
@@ -145,19 +145,19 @@ - (CGRect)rectForItemAtIndexPath:(NSIndexPath *)indexPath {
- (NSIndexPath *)indexPathForItemAtGlobalIndex:(NSInteger)index {
[self validateItemCounts];
-
+
NSAssert(index < _numItems, @"request for index path for global index %d when there are only %d items in the collection view", index, _numItems);
-
+
NSInteger section = 0;
NSInteger countItems = 0;
for (section = 0; section < _numSections; section++) {
NSInteger countIncludingThisSection = countItems + _sectionItemCounts[section];
if (countIncludingThisSection > index) break;
countItems = countIncludingThisSection;
}
-
+
NSInteger item = index - countItems;
-
+
return [NSIndexPath indexPathForItem:item inSection:section];
}
@@ -220,7 +220,7 @@ - (void)updateItemCounts {
_sectionItemCounts[i] = cellCount;
_numItems += cellCount;
}
-
+
_collectionViewDataFlags.itemCountsAreValid = YES;
}
@@ -43,7 +43,7 @@ typedef NS_ENUM(NSInteger, PSTCollectionViewScrollDirection) {
/*
Row alignment options exits in the official UICollectionView, but hasn't been made public API.
-
+
Here's a snippet to test this on UICollectionView:
NSMutableDictionary *rowAlign = [[flowLayout valueForKey:@"_rowAlignmentsOptionsDictionary"] mutableCopy];
@@ -130,7 +130,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
// Apple calls _layoutAttributesForItemsInRect
if (!_data) [self prepareLayout];
-
+
NSMutableArray *layoutAttributesArray = [NSMutableArray array];
for (PSTGridLayoutSection *section in _data.sections) {
if (CGRectIntersectsRect(section.frame, rect)) {
@@ -197,7 +197,7 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
- (PSTCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
if (!_data) [self prepareLayout];
-
+
PSTGridLayoutSection *section = _data.sections[indexPath.section];
PSTGridLayoutRow *row = nil;
CGRect itemFrame = CGRectZero;
@@ -226,7 +226,7 @@ - (PSTCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInd
- (PSTCollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
if (!_data) [self prepareLayout];
-
+
NSUInteger sectionIndex = indexPath.section;
PSTCollectionViewLayoutAttributes *layoutAttributes = nil;
@@ -258,7 +258,7 @@ - (PSTCollectionViewLayoutAttributes *)layoutAttributesForDecorationViewWithReus
- (CGSize)collectionViewContentSize {
if (!_data) [self prepareLayout];
-
+
return _data.contentSize;
}
@@ -295,7 +295,7 @@ - (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentO
- (void)prepareLayout {
// custom ivars
objc_setAssociatedObject(self, &kPSTCachedItemRectsKey, [NSMutableDictionary dictionary], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-
+
_data = [PSTGridLayoutInfo new]; // clear old layout data
_data.horizontal = self.scrollDirection == PSTCollectionViewScrollDirectionHorizontal;
_visibleBounds = self.collectionView.bounds;
@@ -25,8 +25,8 @@ + (id)collectionItemKeyForCellWithIndexPath:(NSIndexPath *)indexPath {
+ (id)collectionItemKeyForLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes {
PSTCollectionViewItemKey *key = [self.class new];
key.indexPath = layoutAttributes.indexPath;
- PSTCollectionViewItemType const itemType = layoutAttributes.representedElementCategory;
- key.type = itemType;
+ PSTCollectionViewItemType const itemType = layoutAttributes.representedElementCategory;
+ key.type = itemType;
key.identifier = layoutAttributes.representedElementKind;
return key;
}

0 comments on commit d87fff8

Please sign in to comment.