Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

I implemented the grid spacing abilities. #19

Open
wants to merge 1 commit into from

1 participant

@msielski

Added findSpacingBetweenRows and findSpacingBetweenColumns which call
optional protocol methods spacingBetweenRowsInGridView and
spacingBetweenColumnsInGridView.

I followed the existing model of having "find" functions which can be overloaded.

@msielski msielski Implemented row and column spacing in grid view.
Added findSpacingBetweenRows and findSpacingBetweenColumns which call
optional protocol methods spacingBetweenRowsInGridView and
spacingBetweenColumnsInGridView.
9677932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 14, 2011
  1. @msielski

    Implemented row and column spacing in grid view.

    msielski authored
    Added findSpacingBetweenRows and findSpacingBetweenColumns which call
    optional protocol methods spacingBetweenRowsInGridView and
    spacingBetweenColumnsInGridView.
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 0 deletions.
  1. +2 −0  DTGridView.h
  2. +21 −0 DTGridView.m
View
2  DTGridView.h 100644 → 100755
@@ -183,6 +183,8 @@ struct DTOutset {
- (NSInteger)findNumberOfColumnsForRow:(NSInteger)row;
- (CGFloat)findHeightForRow:(NSInteger)row;
- (DTGridViewCell *)findViewForRow:(NSInteger)row column:(NSInteger)column;
+- (NSInteger)findSpacingBetweenRows;
+- (NSInteger)findSpacingBetweenColumns;
#pragma mark -
#pragma mark Regular methods
View
21 DTGridView.m 100644 → 100755
@@ -332,6 +332,24 @@ - (CGFloat)findHeightForRow:(NSInteger)row {
- (DTGridViewCell *)findViewForRow:(NSInteger)row column:(NSInteger)column {
return [self.dataSource gridView:self viewForRow:row column:column];
}
+
+- (NSInteger)findSpacingBetweenRows {
+ if ([self.dataSource respondsToSelector:@selector(spacingBetweenRowsInGridView:)]) {
+ return [self.dataSource spacingBetweenRowsInGridView:self];
+ } else {
+ return 0;
+ }
+}
+
+- (NSInteger)findSpacingBetweenColumns {
+ if ([self.dataSource respondsToSelector:@selector(spacingBetweenColumnsInGridView:)]) {
+ return [self.dataSource spacingBetweenColumnsInGridView:self];
+ } else {
+ return 0;
+ }
+}
+
+
#pragma mark -
- (void)loadData {
@@ -346,6 +364,9 @@ - (void)loadData {
if (!self.numberOfRows)
return;
+ cellOffset.x = [self findSpacingBetweenColumns];
+ cellOffset.y = [self findSpacingBetweenRows];
+
[gridRows removeAllObjects];
[rowHeights removeAllObjects];
[rowPositions removeAllObjects];
Something went wrong with that request. Please try again.