Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Interface Builder compatiblity #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PSCollectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
@property (nonatomic, assign, readonly) NSInteger numCols;
@property (nonatomic, assign) NSInteger numColsLandscape;
@property (nonatomic, assign) NSInteger numColsPortrait;
@property (nonatomic, unsafe_unretained) id <PSCollectionViewDelegate> collectionViewDelegate;
@property (nonatomic, unsafe_unretained) id <PSCollectionViewDataSource> collectionViewDataSource;
@property (nonatomic, unsafe_unretained) IBOutlet id <PSCollectionViewDelegate> collectionViewDelegate;
@property (nonatomic, unsafe_unretained) IBOutlet id <PSCollectionViewDataSource> collectionViewDataSource;

#pragma mark - Public Methods

Expand Down
42 changes: 27 additions & 15 deletions PSCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,40 @@ @implementation PSCollectionView

#pragma mark - Init/Memory

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

- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.alwaysBounceVertical = YES;

self.lastOffset = 0.0;
self.offsetThreshold = floorf(self.height / 4.0);

self.colWidth = 0.0;
self.numCols = 0;
self.numColsPortrait = 0;
self.numColsLandscape = 0;
self.orientation = [UIApplication sharedApplication].statusBarOrientation;

self.reuseableViews = [NSMutableDictionary dictionary];
self.visibleViews = [NSMutableDictionary dictionary];
self.viewKeysToRemove = [NSMutableArray array];
self.indexToRectMap = [NSMutableDictionary dictionary];
[self setup];
}
return self;
}

- (void)setup {
self.alwaysBounceVertical = YES;

self.lastOffset = 0.0;
self.offsetThreshold = floorf(self.height / 4.0);

self.colWidth = 0.0;
self.numCols = 0;
self.numColsPortrait = 0;
self.numColsLandscape = 0;
self.orientation = [UIApplication sharedApplication].statusBarOrientation;

self.reuseableViews = [NSMutableDictionary dictionary];
self.visibleViews = [NSMutableDictionary dictionary];
self.viewKeysToRemove = [NSMutableArray array];
self.indexToRectMap = [NSMutableDictionary dictionary];
}

- (void)dealloc {
// clear delegates
self.delegate = nil;
Expand Down