Skip to content

Commit

Permalink
Added initWithCoder method so it works from NIB / StoryBoard
Browse files Browse the repository at this point in the history
initwithFrame is not called when created from a NIB or Storyboard so
needed to add the initialisation code to initWithCoder too.
  • Loading branch information
Ryan Slade committed Aug 9, 2012
1 parent 925662f commit cd6e2cb
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions DTInfiniteGridView/DTInfiniteGridView.m
Expand Up @@ -13,16 +13,33 @@ @implementation DTInfiniteGridView

@synthesize infiniteVerticalScrolling, infiniteHorizontalScrolling;

- (void) setup
{
numberOfColumns = [[NSMutableDictionary alloc] init];
self.showsHorizontalScrollIndicator = NO;
self.bounces = NO;
}

- (id)initWithFrame:(CGRect)frame {

if (!(self = [super initWithFrame:frame])) return nil;

numberOfColumns = [[NSMutableDictionary alloc] init];
self.showsHorizontalScrollIndicator = NO;
self.bounces = NO;
[self setup];

return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];

if (self) {
[self setup];
}

return self;
}

- (NSInteger)realRowNumber:(NSInteger)row {
if (row >= fakeNumberOfRows)
return (row % fakeNumberOfRows);
Expand Down

0 comments on commit cd6e2cb

Please sign in to comment.