Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating read me file

  • Loading branch information...
commit 3d5051e76cd0ce54d7aa0c5dd67b8d7f5fa22243 1 parent 3e34a31
@ixnixnixn authored
Showing with 18 additions and 10 deletions.
  1. +18 −10 README.md
View
28 README.md
@@ -29,26 +29,34 @@ or via IB by ctrl+drag it to your view controller and add as its `dataSource`
``` objective-c
- (UIView *)infiniteGridView:(IAInfiniteGridView *)gridView forIndex:(NSInteger)gridIndex {
UIView *grid = [self.gridView dequeueReusableGrid];
+
+ CGFloat gridWidth = [self infiniteGridView:gridView widthForIndex:gridIndex];
+ CGRect frame = CGRectMake(0.0, 0.0, gridWidth, gridView.bounds.size.height);
+
+ UILabel *numberLabel;
if (grid == nil) {
- CGRect frame = CGRectMake(0.0, 0.0, [self infiniteGridSize].width, [self infiniteGridSize].height);
- grid = [[UIView alloc] initWithFrame:frame];
+ grid = [[UIView alloc] initWithFrame:frame];
- UILabel *numberLabel = [[UILabel alloc] initWithFrame:frame];
+ numberLabel = [[UILabel alloc] initWithFrame:frame];
[numberLabel setBackgroundColor:[UIColor clearColor]];
- [numberLabel setFont:[UIFont boldSystemFontOfSize:([self infiniteGridSize].height * .4)]];
[numberLabel setTextColor:[UIColor whiteColor]];
+ [numberLabel setFont:[UIFont boldSystemFontOfSize:(gridView.bounds.size.height * .4)]];
[numberLabel setTextAlignment:NSTextAlignmentCenter];
[numberLabel setTag:kNumberLabelTag];
[grid addSubview:numberLabel];
- }
+ } else {
+ grid.frame = frame;
+ numberLabel = (UILabel *)[grid viewWithTag:kNumberLabelTag];
+ numberLabel.frame = frame;
+ }
- // set properties
- NSInteger mods = gridIndex % [self numberOfInfiniteGrids];
- if (mods < 0) mods += [self numberOfInfiniteGrids];
- CGFloat red = mods * (1 / (CGFloat)[self numberOfInfiniteGrids]);
+ // set properties
+ NSInteger mods = gridIndex % [self numberOfGridsInInfiniteGridView:gridView];
+ if (mods < 0) mods += [self numberOfGridsInInfiniteGridView:gridView];
+ CGFloat red = mods * (1 / (CGFloat)[self numberOfGridsInInfiniteGridView:gridView]);
grid.backgroundColor = [UIColor colorWithRed:red green:0.0 blue:0.0 alpha:1.0];
- UILabel *numberLabel = (UILabel *)[grid viewWithTag:kNumberLabelTag];
+ // set text
[numberLabel setText:[NSString stringWithFormat:@"[%d]", gridIndex]];
return grid;
Please sign in to comment.
Something went wrong with that request. Please try again.