Skip to content
This repository
Browse code

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
@@ -76,30 +76,30 @@ - (UIView *)gridView:(KKGridView *)gridView viewForFooterInSection:(NSUInteger)s
76 76
77 77 - (void)gridView:(KKGridView *)gridView didSelectItemAtIndexPath:(KKIndexPath *)indexPath
78 78 {
79   - if (_didSelectItem)
80   - _didSelectItem(gridView,indexPath);
  79 + if (_didSelectItem)
  80 + _didSelectItem(gridView,indexPath);
81 81 }
82 82
83 83 - (void)gridView:(KKGridView *)gridView didDeselectItemAtIndexPath:(KKIndexPath *)indexPath
84 84 {
85   - if (_didDeselectItem)
86   - _didDeselectItem(gridView,indexPath);
  85 + if (_didDeselectItem)
  86 + _didDeselectItem(gridView,indexPath);
87 87 }
88 88
89 89 - (KKIndexPath *)gridView:(KKGridView *)gridView willSelectItemAtIndexPath:(KKIndexPath *)indexPath
90 90 {
91   - return _willSelectItem ? _willSelectItem(gridView,indexPath) : indexPath;
  91 + return _willSelectItem ? _willSelectItem(gridView,indexPath) : indexPath;
92 92 }
93 93
94 94 - (KKIndexPath *)gridView:(KKGridView *)gridView willDeselectItemAtIndexPath:(KKIndexPath *)indexPath
95 95 {
96   - return _willDeselectItem ? _willDeselectItem(gridView,indexPath) : indexPath;
  96 + return _willDeselectItem ? _willDeselectItem(gridView,indexPath) : indexPath;
97 97 }
98 98
99 99 - (void)gridView:(KKGridView *)gridView willDisplayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath
100 100 {
101   - if (_willDisplayCell)
102   - _willDisplayCell(gridView,cell,indexPath);
  101 + if (_willDisplayCell)
  102 + _willDisplayCell(gridView,cell,indexPath);
103 103 }
104 104
105 105 @end
38 KKGridView/KKGridView.m
@@ -321,14 +321,14 @@ - (void)setGridFooterView:(UIView *)gridFooterView
321 321
322 322 - (void)setBackgroundView:(UIView *)backgroundView
323 323 {
324   - if (_backgroundView != backgroundView) {
325   - [_backgroundView removeFromSuperview];
326   - _backgroundView = backgroundView;
327   - _backgroundView.frame = self.bounds;
328   -
329   - [self addSubview:_backgroundView];
330   - [self sendSubviewToBack:_backgroundView];
331   - }
  324 + if (_backgroundView != backgroundView) {
  325 + [_backgroundView removeFromSuperview];
  326 + _backgroundView = backgroundView;
  327 + _backgroundView.frame = self.bounds;
  328 +
  329 + [self addSubview:_backgroundView];
  330 + [self sendSubviewToBack:_backgroundView];
  331 + }
332 332 }
333 333
334 334 #pragma mark - Root Layout Methods
@@ -354,9 +354,9 @@ - (void)_layoutGridView
354 354 - (void)_layoutSectionViews
355 355 {
356 356 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);
357   -
358   - _backgroundView.frame = visibleBounds;
359   -
  357 +
  358 + _backgroundView.frame = visibleBounds;
  359 +
360 360 CGFloat offset = self.contentOffset.y + self.contentInset.top;
361 361
362 362 for (KKGridViewHeader *header in _headerViews) {
@@ -414,7 +414,7 @@ - (void)_layoutSectionViews
414 414 // move footer view to right below scroller
415 415 [footer.view removeFromSuperview];
416 416 [self _insertSubviewBelowScrollbar:footer.view];
417   -
  417 +
418 418 } else {
419 419 // footer isn't sticky anymore, set originTop to saved position
420 420 f.origin.y = footer->stickPoint;
@@ -451,7 +451,7 @@ - (void)_layoutVisibleCells
451 451 void (^updateCellFrame)(id,id) = ^(KKGridViewCell *cell, KKIndexPath *indexPath) {
452 452 cell.frame = [self rectForCellAtIndexPath:indexPath];
453 453 };
454   -
  454 +
455 455
456 456 for (KKIndexPath *indexPath in visiblePaths) {
457 457 // Updates
@@ -500,7 +500,7 @@ - (void)_layoutVisibleCells
500 500 [replacementSet addObject:keyPath];
501 501 }
502 502 }
503   -
  503 +
504 504 [_selectedIndexPaths setSet:replacementSet];
505 505
506 506 [self reloadContentSize];
@@ -659,7 +659,7 @@ - (void)_displayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath
659 659 break;
660 660 }
661 661
662   - [self addSubview:cell];
  662 + [self addSubview:cell];
663 663
664 664 switch (animation) {
665 665 case KKGridViewAnimationExplode: {
@@ -1057,7 +1057,7 @@ - (void)_commonReload
1057 1057 animated:NO
1058 1058 position:KKGridViewScrollPositionTop];
1059 1059 }];
1060   -
  1060 +
1061 1061 [self _insertSubviewBelowScrollbar:_indexView];
1062 1062 }
1063 1063 }
@@ -1216,14 +1216,14 @@ - (UIView *)_viewForFooterInSection:(NSUInteger)section
1216 1216 }
1217 1217
1218 1218 #pragma mark - Subviewinsertion
1219   -
  1219 +
1220 1220 - (void)_insertSubviewBelowScrollbar:(UIView *)view {
1221 1221 if (_indexView && view != _indexView)
1222 1222 [self insertSubview:view belowSubview:_indexView];
1223 1223 else
1224 1224 [self insertSubview:view atIndex:self.subviews.count - 1];
1225 1225 }
1226   -
  1226 +
1227 1227 #pragma mark - Positioning
1228 1228
1229 1229 - (void)scrollToItemAtIndexPath:(KKIndexPath *)indexPath animated:(BOOL)animated position:(KKGridViewScrollPosition)scrollPosition
@@ -1386,7 +1386,7 @@ - (void)_handleSelection:(UILongPressGestureRecognizer *)recognizer
1386 1386 return;
1387 1387 }
1388 1388 }
1389   -
  1389 +
1390 1390 if ([self isDecelerating])
1391 1391 return;
1392 1392
38 KKGridView/KKGridViewCell.m
@@ -57,7 +57,7 @@ - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
57 57 {
58 58 if ((self = [super initWithFrame:frame])) {
59 59 self.reuseIdentifier = reuseIdentifier;
60   -
  60 +
61 61 _backgroundView = [[UIView alloc] initWithFrame:self.bounds];
62 62 _backgroundView.backgroundColor = [UIColor whiteColor];
63 63 [self addSubview:_backgroundView];
@@ -66,8 +66,8 @@ - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
66 66 _selectedBackgroundView.hidden = YES;
67 67 _selectedBackgroundView.alpha = 0.f;
68 68 [self addSubview:_selectedBackgroundView];
69   -
70   - _contentView = [[UIView alloc] initWithFrame:self.bounds];
  69 +
  70 + _contentView = [[UIView alloc] initWithFrame:self.bounds];
71 71 _contentView.backgroundColor = [UIColor whiteColor];
72 72 [self addSubview:_contentView];
73 73
@@ -149,9 +149,9 @@ - (void)setSelected:(BOOL)selected
149 149 if (_selected != selected) {
150 150 _selected = selected;
151 151 [self setNeedsLayout];
152   -
153   - if (selected && !_selectedBackgroundView.backgroundColor)
154   - _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
  152 +
  153 + if (selected && !_selectedBackgroundView.backgroundColor)
  154 + _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
155 155 }
156 156 }
157 157
@@ -160,9 +160,9 @@ - (void)setHighlighted:(BOOL)highlighted
160 160 if (_highlighted != highlighted) {
161 161 _highlighted = highlighted;
162 162 [self setNeedsLayout];
163   -
164   - if (highlighted && !_selectedBackgroundView.backgroundColor)
165   - _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
  163 +
  164 + if (highlighted && !_selectedBackgroundView.backgroundColor)
  165 + _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
166 166 }
167 167 }
168 168
@@ -184,14 +184,14 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated
184 184
185 185 - (void)setSelectedBackgroundView:(UIView *)selectedBackgroundView
186 186 {
187   - if (_selectedBackgroundView == selectedBackgroundView)
188   - return;
189   -
190   - _ignoreUserContentViewBackground = !!_selectedBackgroundView; // if we have a custom background view, we don't set the color.
191   -
192   - if (selectedBackgroundView)
193   - _selectedBackgroundView = selectedBackgroundView;
194   - else _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
  187 + if (_selectedBackgroundView == selectedBackgroundView)
  188 + return;
  189 +
  190 + _ignoreUserContentViewBackground = !!_selectedBackgroundView; // if we have a custom background view, we don't set the color.
  191 +
  192 + if (selectedBackgroundView)
  193 + _selectedBackgroundView = selectedBackgroundView;
  194 + else _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
195 195 }
196 196
197 197 - (void)_updateSubviewSelectionState
@@ -284,7 +284,7 @@ - (void)_layoutAccessories
284 284 [KKGridViewCellAccessoryTypeBadgeNumeric] = {29.f, 0.f},
285 285 [KKGridViewCellAccessoryTypeCheckmark] = {14.f, 0.f},
286 286 };
287   -
  287 +
288 288 CGFloat w = self.bounds.size.width;
289 289 CGFloat h = self.bounds.size.height;
290 290 CGFloat s = map[self.accessoryType].sideLength;
@@ -302,7 +302,7 @@ - (void)_layoutAccessories
302 302
303 303 if (normalBadges[self.accessoryType])
304 304 {
305   - [_badgeView setBackgroundImage:normalBadges[self.accessoryType] forState:UIControlStateNormal];
  305 + [_badgeView setBackgroundImage:normalBadges[self.accessoryType] forState:UIControlStateNormal];
306 306 }
307 307
308 308 if (pressedBadges[self.accessoryType])
4 KKGridView/KKGridViewIndexView.m
@@ -99,7 +99,7 @@ - (void)setSectionIndexTitles:(NSArray *)sectionIndexTitles {
99 99 maxWidth + 2*KKGridViewIndexViewPadding + 2*KKGridViewIndexViewMargin,
100 100 self.frame.size.height
101 101 };
102   -
  102 +
103 103 self.frame = (CGRect){self.frame.origin, size};
104 104 [self setNeedsDisplay];
105 105 }
@@ -112,7 +112,7 @@ - (void)setTracking:(BOOL)tracking location:(CGPoint)location {
112 112 NSUInteger sections = [_sectionIndexTitles count];
113 113 CGFloat sectionHeight = (self.bounds.size.height - 2*KKGridViewIndexViewMargin)/sections;
114 114 location.y -= KKGridViewIndexViewMargin;
115   -
  115 +
116 116 _lastTrackingSection = floorf(abs(location.y)/sectionHeight);
117 117
118 118 if (_lastTrackingSection == _sectionIndexTitles.count)
2  KKGridView/KKGridViewUpdateStack.m
@@ -70,7 +70,7 @@ - (KKGridViewUpdate *)updateForIndexPath:(KKIndexPath *)indexPath
70 70
71 71 - (BOOL)hasUpdateForIndexPath:(KKIndexPath *)indexPath
72 72 {
73   - NSUInteger count = _itemsToUpdate.count;
  73 + NSUInteger count = _itemsToUpdate.count;
74 74
75 75 if (count == 0)
76 76 return NO;
24 KKGridView/KKIndexPath.m
@@ -50,13 +50,13 @@ - (NSComparisonResult)compare:(KKIndexPath *)otherIndexPath
50 50
51 51 + (NSArray *) indexPathsWithNSIndexPaths:(NSArray *) indexPaths
52 52 {
53   - NSMutableArray *convertedIndexPaths = [NSMutableArray array];
  53 + NSMutableArray *convertedIndexPaths = [NSMutableArray array];
54 54
55   - for (NSIndexPath *indexPath in indexPaths) {
56   - [convertedIndexPaths addObject:[self indexPathWithNSIndexPath:indexPath]];
57   - }
  55 + for (NSIndexPath *indexPath in indexPaths) {
  56 + [convertedIndexPaths addObject:[self indexPathWithNSIndexPath:indexPath]];
  57 + }
58 58
59   - return convertedIndexPaths;
  59 + return convertedIndexPaths;
60 60 }
61 61
62 62 + (id)indexPathForIndex:(NSUInteger)index inSection:(NSUInteger)section
@@ -81,9 +81,9 @@ + (id)indexPathWithNSIndexPath:(NSIndexPath *)indexPath
81 81
82 82 - (BOOL)isEqual:(KKIndexPath *)indexPath
83 83 {
84   - if (indexPath == self) {
85   - return YES;
86   - }
  84 + if (indexPath == self) {
  85 + return YES;
  86 + }
87 87
88 88 return (indexPath->_index == _index && indexPath->_section == _section);
89 89 }
@@ -97,10 +97,10 @@ - (NSUInteger)hash
97 97
98 98 - (id)copyWithZone:(NSZone *)zone
99 99 {
100   - KKIndexPath *indexPath = [[[self class] alloc] init];
101   - indexPath->_index = _index;
102   - indexPath->_section = _section;
103   - return indexPath;
  100 + KKIndexPath *indexPath = [[[self class] alloc] init];
  101 + indexPath->_index = _index;
  102 + indexPath->_section = _section;
  103 + return indexPath;
104 104 }
105 105
106 106 - (NSString *)description

0 comments on commit 8bef7bd

Please sign in to comment.
Something went wrong with that request. Please try again.