Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Normalized spacing before merge

We currently use 4-spaces rather than tabs.
  • Loading branch information...
commit 8bef7bdf489af9fd14a9349437d928e8690eb6ed 1 parent 3e0ca03
Jonathan Sterling jonsterling authored
16 KKGridView/KKBlocksDelegate.m
View
@@ -76,30 +76,30 @@ - (UIView *)gridView:(KKGridView *)gridView viewForFooterInSection:(NSUInteger)s
- (void)gridView:(KKGridView *)gridView didSelectItemAtIndexPath:(KKIndexPath *)indexPath
{
- if (_didSelectItem)
- _didSelectItem(gridView,indexPath);
+ if (_didSelectItem)
+ _didSelectItem(gridView,indexPath);
}
- (void)gridView:(KKGridView *)gridView didDeselectItemAtIndexPath:(KKIndexPath *)indexPath
{
- if (_didDeselectItem)
- _didDeselectItem(gridView,indexPath);
+ if (_didDeselectItem)
+ _didDeselectItem(gridView,indexPath);
}
- (KKIndexPath *)gridView:(KKGridView *)gridView willSelectItemAtIndexPath:(KKIndexPath *)indexPath
{
- return _willSelectItem ? _willSelectItem(gridView,indexPath) : indexPath;
+ return _willSelectItem ? _willSelectItem(gridView,indexPath) : indexPath;
}
- (KKIndexPath *)gridView:(KKGridView *)gridView willDeselectItemAtIndexPath:(KKIndexPath *)indexPath
{
- return _willDeselectItem ? _willDeselectItem(gridView,indexPath) : indexPath;
+ return _willDeselectItem ? _willDeselectItem(gridView,indexPath) : indexPath;
}
- (void)gridView:(KKGridView *)gridView willDisplayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath
{
- if (_willDisplayCell)
- _willDisplayCell(gridView,cell,indexPath);
+ if (_willDisplayCell)
+ _willDisplayCell(gridView,cell,indexPath);
}
@end
38 KKGridView/KKGridView.m
View
@@ -321,14 +321,14 @@ - (void)setGridFooterView:(UIView *)gridFooterView
- (void)setBackgroundView:(UIView *)backgroundView
{
- if (_backgroundView != backgroundView) {
- [_backgroundView removeFromSuperview];
- _backgroundView = backgroundView;
- _backgroundView.frame = self.bounds;
-
- [self addSubview:_backgroundView];
- [self sendSubviewToBack:_backgroundView];
- }
+ if (_backgroundView != backgroundView) {
+ [_backgroundView removeFromSuperview];
+ _backgroundView = backgroundView;
+ _backgroundView.frame = self.bounds;
+
+ [self addSubview:_backgroundView];
+ [self sendSubviewToBack:_backgroundView];
+ }
}
#pragma mark - Root Layout Methods
@@ -354,9 +354,9 @@ - (void)_layoutGridView
- (void)_layoutSectionViews
{
CGRect visibleBounds = CGRectMake(self.contentOffset.x + self.contentInset.left, self.contentOffset.y + self.contentInset.top, self.bounds.size.width - self.contentInset.right, self.bounds.size.height - self.contentInset.bottom);
-
- _backgroundView.frame = visibleBounds;
-
+
+ _backgroundView.frame = visibleBounds;
+
CGFloat offset = self.contentOffset.y + self.contentInset.top;
for (KKGridViewHeader *header in _headerViews) {
@@ -414,7 +414,7 @@ - (void)_layoutSectionViews
// move footer view to right below scroller
[footer.view removeFromSuperview];
[self _insertSubviewBelowScrollbar:footer.view];
-
+
} else {
// footer isn't sticky anymore, set originTop to saved position
f.origin.y = footer->stickPoint;
@@ -451,7 +451,7 @@ - (void)_layoutVisibleCells
void (^updateCellFrame)(id,id) = ^(KKGridViewCell *cell, KKIndexPath *indexPath) {
cell.frame = [self rectForCellAtIndexPath:indexPath];
};
-
+
for (KKIndexPath *indexPath in visiblePaths) {
// Updates
@@ -500,7 +500,7 @@ - (void)_layoutVisibleCells
[replacementSet addObject:keyPath];
}
}
-
+
[_selectedIndexPaths setSet:replacementSet];
[self reloadContentSize];
@@ -659,7 +659,7 @@ - (void)_displayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath
break;
}
- [self addSubview:cell];
+ [self addSubview:cell];
switch (animation) {
case KKGridViewAnimationExplode: {
@@ -1057,7 +1057,7 @@ - (void)_commonReload
animated:NO
position:KKGridViewScrollPositionTop];
}];
-
+
[self _insertSubviewBelowScrollbar:_indexView];
}
}
@@ -1216,14 +1216,14 @@ - (UIView *)_viewForFooterInSection:(NSUInteger)section
}
#pragma mark - Subviewinsertion
-
+
- (void)_insertSubviewBelowScrollbar:(UIView *)view {
if (_indexView && view != _indexView)
[self insertSubview:view belowSubview:_indexView];
else
[self insertSubview:view atIndex:self.subviews.count - 1];
}
-
+
#pragma mark - Positioning
- (void)scrollToItemAtIndexPath:(KKIndexPath *)indexPath animated:(BOOL)animated position:(KKGridViewScrollPosition)scrollPosition
@@ -1386,7 +1386,7 @@ - (void)_handleSelection:(UILongPressGestureRecognizer *)recognizer
return;
}
}
-
+
if ([self isDecelerating])
return;
38 KKGridView/KKGridViewCell.m
View
@@ -57,7 +57,7 @@ - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
{
if ((self = [super initWithFrame:frame])) {
self.reuseIdentifier = reuseIdentifier;
-
+
_backgroundView = [[UIView alloc] initWithFrame:self.bounds];
_backgroundView.backgroundColor = [UIColor whiteColor];
[self addSubview:_backgroundView];
@@ -66,8 +66,8 @@ - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
_selectedBackgroundView.hidden = YES;
_selectedBackgroundView.alpha = 0.f;
[self addSubview:_selectedBackgroundView];
-
- _contentView = [[UIView alloc] initWithFrame:self.bounds];
+
+ _contentView = [[UIView alloc] initWithFrame:self.bounds];
_contentView.backgroundColor = [UIColor whiteColor];
[self addSubview:_contentView];
@@ -149,9 +149,9 @@ - (void)setSelected:(BOOL)selected
if (_selected != selected) {
_selected = selected;
[self setNeedsLayout];
-
- if (selected && !_selectedBackgroundView.backgroundColor)
- _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
+
+ if (selected && !_selectedBackgroundView.backgroundColor)
+ _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
}
}
@@ -160,9 +160,9 @@ - (void)setHighlighted:(BOOL)highlighted
if (_highlighted != highlighted) {
_highlighted = highlighted;
[self setNeedsLayout];
-
- if (highlighted && !_selectedBackgroundView.backgroundColor)
- _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
+
+ if (highlighted && !_selectedBackgroundView.backgroundColor)
+ _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
}
}
@@ -184,14 +184,14 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated
- (void)setSelectedBackgroundView:(UIView *)selectedBackgroundView
{
- if (_selectedBackgroundView == selectedBackgroundView)
- return;
-
- _ignoreUserContentViewBackground = !!_selectedBackgroundView; // if we have a custom background view, we don't set the color.
-
- if (selectedBackgroundView)
- _selectedBackgroundView = selectedBackgroundView;
- else _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
+ if (_selectedBackgroundView == selectedBackgroundView)
+ return;
+
+ _ignoreUserContentViewBackground = !!_selectedBackgroundView; // if we have a custom background view, we don't set the color.
+
+ if (selectedBackgroundView)
+ _selectedBackgroundView = selectedBackgroundView;
+ else _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
}
- (void)_updateSubviewSelectionState
@@ -284,7 +284,7 @@ - (void)_layoutAccessories
[KKGridViewCellAccessoryTypeBadgeNumeric] = {29.f, 0.f},
[KKGridViewCellAccessoryTypeCheckmark] = {14.f, 0.f},
};
-
+
CGFloat w = self.bounds.size.width;
CGFloat h = self.bounds.size.height;
CGFloat s = map[self.accessoryType].sideLength;
@@ -302,7 +302,7 @@ - (void)_layoutAccessories
if (normalBadges[self.accessoryType])
{
- [_badgeView setBackgroundImage:normalBadges[self.accessoryType] forState:UIControlStateNormal];
+ [_badgeView setBackgroundImage:normalBadges[self.accessoryType] forState:UIControlStateNormal];
}
if (pressedBadges[self.accessoryType])
4 KKGridView/KKGridViewIndexView.m
View
@@ -99,7 +99,7 @@ - (void)setSectionIndexTitles:(NSArray *)sectionIndexTitles {
maxWidth + 2*KKGridViewIndexViewPadding + 2*KKGridViewIndexViewMargin,
self.frame.size.height
};
-
+
self.frame = (CGRect){self.frame.origin, size};
[self setNeedsDisplay];
}
@@ -112,7 +112,7 @@ - (void)setTracking:(BOOL)tracking location:(CGPoint)location {
NSUInteger sections = [_sectionIndexTitles count];
CGFloat sectionHeight = (self.bounds.size.height - 2*KKGridViewIndexViewMargin)/sections;
location.y -= KKGridViewIndexViewMargin;
-
+
_lastTrackingSection = floorf(abs(location.y)/sectionHeight);
if (_lastTrackingSection == _sectionIndexTitles.count)
2  KKGridView/KKGridViewUpdateStack.m
View
@@ -70,7 +70,7 @@ - (KKGridViewUpdate *)updateForIndexPath:(KKIndexPath *)indexPath
- (BOOL)hasUpdateForIndexPath:(KKIndexPath *)indexPath
{
- NSUInteger count = _itemsToUpdate.count;
+ NSUInteger count = _itemsToUpdate.count;
if (count == 0)
return NO;
24 KKGridView/KKIndexPath.m
View
@@ -50,13 +50,13 @@ - (NSComparisonResult)compare:(KKIndexPath *)otherIndexPath
+ (NSArray *) indexPathsWithNSIndexPaths:(NSArray *) indexPaths
{
- NSMutableArray *convertedIndexPaths = [NSMutableArray array];
+ NSMutableArray *convertedIndexPaths = [NSMutableArray array];
- for (NSIndexPath *indexPath in indexPaths) {
- [convertedIndexPaths addObject:[self indexPathWithNSIndexPath:indexPath]];
- }
+ for (NSIndexPath *indexPath in indexPaths) {
+ [convertedIndexPaths addObject:[self indexPathWithNSIndexPath:indexPath]];
+ }
- return convertedIndexPaths;
+ return convertedIndexPaths;
}
+ (id)indexPathForIndex:(NSUInteger)index inSection:(NSUInteger)section
@@ -81,9 +81,9 @@ + (id)indexPathWithNSIndexPath:(NSIndexPath *)indexPath
- (BOOL)isEqual:(KKIndexPath *)indexPath
{
- if (indexPath == self) {
- return YES;
- }
+ if (indexPath == self) {
+ return YES;
+ }
return (indexPath->_index == _index && indexPath->_section == _section);
}
@@ -97,10 +97,10 @@ - (NSUInteger)hash
- (id)copyWithZone:(NSZone *)zone
{
- KKIndexPath *indexPath = [[[self class] alloc] init];
- indexPath->_index = _index;
- indexPath->_section = _section;
- return indexPath;
+ KKIndexPath *indexPath = [[[self class] alloc] init];
+ indexPath->_index = _index;
+ indexPath->_section = _section;
+ return indexPath;
}
- (NSString *)description
Please sign in to comment.
Something went wrong with that request. Please try again.