Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: soffes/sstoolkit
...
head fork: axfree/sstoolkit
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Dec 12, 2011
AxFree - Subclass SSCollectionView from UITableView for fullscreen layout
  support. Without this patch, first few rows of collection view will be
  hidden under translucent status bar or navigation bar.
75605fb
View
8 SSToolkit.xcodeproj/project.pbxproj
@@ -17,8 +17,6 @@
B21D2E00121F2FE500161E66 /* SSDrawingUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = B21D2DFF121F2FE500161E66 /* SSDrawingUtilities.m */; };
B227D2EA124931590078A059 /* NSDictionary+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B227D2E8124931590078A059 /* NSDictionary+SSToolkitAdditions.h */; };
B227D2EB124931590078A059 /* NSDictionary+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B227D2E9124931590078A059 /* NSDictionary+SSToolkitAdditions.m */; };
- B229B468144CE2F500F71626 /* SSCollectionViewTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = B229B466144CE2F500F71626 /* SSCollectionViewTableView.h */; };
- B229B469144CE2F500F71626 /* SSCollectionViewTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = B229B467144CE2F500F71626 /* SSCollectionViewTableView.m */; };
B23910571357DC7D00ADE21B /* GHUnitIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B23910551357DC7D00ADE21B /* GHUnitIOS.framework */; };
B23910601357DCF700ADE21B /* libSSToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC07E0554694100DB518D /* libSSToolkit.a */; };
B23910621357DCF700ADE21B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B23910611357DCF700ADE21B /* CoreGraphics.framework */; };
@@ -157,8 +155,6 @@
B21D2DFF121F2FE500161E66 /* SSDrawingUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSDrawingUtilities.m; sourceTree = "<group>"; };
B227D2E8124931590078A059 /* NSDictionary+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+SSToolkitAdditions.h"; sourceTree = "<group>"; };
B227D2E9124931590078A059 /* NSDictionary+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+SSToolkitAdditions.m"; sourceTree = "<group>"; };
- B229B466144CE2F500F71626 /* SSCollectionViewTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCollectionViewTableView.h; sourceTree = "<group>"; };
- B229B467144CE2F500F71626 /* SSCollectionViewTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCollectionViewTableView.m; sourceTree = "<group>"; };
B239101D1357DC3E00ADE21B /* SSToolkitTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSToolkitTests.app; sourceTree = BUILT_PRODUCTS_DIR; };
B23910551357DC7D00ADE21B /* GHUnitIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GHUnitIOS.framework; sourceTree = "<group>"; };
B23910561357DC7D00ADE21B /* SSToolkitTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SSToolkitTests-Info.plist"; sourceTree = "<group>"; };
@@ -560,8 +556,6 @@
B2D8829313328EEF006B3F55 /* SSHUDWindow.m */,
B279539C12FC6C6F00FFE28D /* SSRatingPickerScrollView.h */,
B279539D12FC6C6F00FFE28D /* SSRatingPickerScrollView.m */,
- B229B466144CE2F500F71626 /* SSCollectionViewTableView.h */,
- B229B467144CE2F500F71626 /* SSCollectionViewTableView.m */,
);
name = Private;
sourceTree = "<group>";
@@ -637,7 +631,6 @@
B25C8E611394327000DE7BFF /* SSCollectionViewExtremityTableViewCell.h in Headers */,
B2136B3C13ABCC0C00FEBCFD /* SSBorderedView.h in Headers */,
B280E25F13BA76A300FCDA5C /* SSAnimatedImageView.h in Headers */,
- B229B468144CE2F500F71626 /* SSCollectionViewTableView.h in Headers */,
B24F7AC9146B2CB7003255E2 /* SSManagedOperationQueue.h in Headers */,
B24F7ACD146B2D54003255E2 /* SSManagedOperation.h in Headers */,
);
@@ -791,7 +784,6 @@
B25C8E601394327000DE7BFF /* SSCollectionViewExtremityTableViewCell.m in Sources */,
B2136B3D13ABCC0C00FEBCFD /* SSBorderedView.m in Sources */,
B280E25D13BA769C00FCDA5C /* SSAnimatedImageView.m in Sources */,
- B229B469144CE2F500F71626 /* SSCollectionViewTableView.m in Sources */,
B24F7ACA146B2CB7003255E2 /* SSManagedOperationQueue.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
View
6 SSToolkit/SSCollectionView.h
@@ -82,7 +82,7 @@ typedef enum {
instead of row. This is done to make working with other classes that use `NSIndexPath` (like
`NSFetchedResultsController`) easier.
*/
-@interface SSCollectionView : UIView
+@interface SSCollectionView : UITableView
///------------------------------------
/// @name Configuring a Collection View
@@ -442,12 +442,12 @@ typedef enum {
/**
The object that acts as the data source of the receiving collection view.
*/
-@property (nonatomic, assign) id<SSCollectionViewDataSource> dataSource;
+@property (nonatomic, assign) id<SSCollectionViewDataSource> collectionDataSource;
/**
The object that acts as the delegate of the receiving collection view.
*/
-@property (nonatomic, assign) id<SSCollectionViewDelegate> delegate;
+@property (nonatomic, assign) id<SSCollectionViewDelegate> collectionDelegate;
@end
View
194 SSToolkit/SSCollectionView.m
@@ -12,7 +12,6 @@
#import "SSCollectionViewItemInternal.h"
#import "SSCollectionViewItemTableViewCell.h"
#import "SSCollectionViewExtremityTableViewCell.h"
-#import "SSCollectionViewTableView.h"
#import "SSDrawingUtilities.h"
#import "UIView+SSToolkitAdditions.h"
@@ -51,8 +50,6 @@ - (void)_setSectionInfoItem:(id)object forKey:(NSString *)key section:(NSUIntege
@end
@implementation SSCollectionView {
- SSCollectionViewTableView *_tableView;
-
NSMutableSet *_visibleItems;
NSMutableDictionary *_reuseableItems;
NSMutableDictionary *_sectionCache;
@@ -62,8 +59,8 @@ @implementation SSCollectionView {
#pragma mark - Accessors
-@synthesize dataSource = _dataSource;
-@synthesize delegate = _delegate;
+@synthesize collectionDataSource = __dataSource;
+@synthesize collectionDelegate = __delegate;
@synthesize minimumColumnSpacing = _minimumColumnSpacing;
@synthesize rowSpacing = _rowSpacing;
@synthesize allowsSelection = _allowsSelection;
@@ -73,8 +70,8 @@ @implementation SSCollectionView {
#pragma mark - NSObject
- (void)dealloc {
- self.dataSource = nil;
- self.delegate = nil;
+ self.collectionDataSource = nil;
+ self.collectionDelegate = nil;
[_visibleItems removeAllObjects];
[_visibleItems release];
@@ -84,9 +81,8 @@ - (void)dealloc {
[_reuseableItems release];
_reuseableItems = nil;
- _tableView.dataSource = nil;
- _tableView.delegate = nil;
- [_tableView release];
+ super.dataSource = nil;
+ super.delegate = nil;
[_sectionCache removeAllObjects];
[_sectionCache release];
@@ -131,12 +127,6 @@ - (void)setFrame:(CGRect)frame {
}
-- (void)setBackgroundColor:(UIColor *)color {
- [super setBackgroundColor:color];
- _tableView.backgroundColor = color;
-}
-
-
#pragma mark - Configuring a Collection View
- (SSCollectionViewItem *)dequeueReusableItemWithIdentifier:(NSString *)identifier {
@@ -160,10 +150,10 @@ - (SSCollectionViewItem *)dequeueReusableItemWithIdentifier:(NSString *)identifi
- (NSUInteger)numberOfItemsInSection:(NSUInteger)section {
NSNumber *items = [self _sectionInfoItemForKey:kSSCollectionViewSectionNumberOfItemsKey section:section];
if (!items) {
- if ([_dataSource respondsToSelector:@selector(collectionView:numberOfItemsInSection:)] == NO) {
+ if ([__dataSource respondsToSelector:@selector(collectionView:numberOfItemsInSection:)] == NO) {
return 0;
}
- items = [NSNumber numberWithUnsignedInteger:[_dataSource collectionView:self numberOfItemsInSection:section]];
+ items = [NSNumber numberWithUnsignedInteger:[__dataSource collectionView:self numberOfItemsInSection:section]];
[self _setSectionInfoItem:items forKey:kSSCollectionViewSectionNumberOfItemsKey section:section];
}
return [items unsignedIntegerValue];
@@ -171,8 +161,8 @@ - (NSUInteger)numberOfItemsInSection:(NSUInteger)section {
- (NSUInteger)numberOfSections {
- if ([_dataSource respondsToSelector:@selector(numberOfSectionsInCollectionView:)]) {
- return [_dataSource numberOfSectionsInCollectionView:self];
+ if ([__dataSource respondsToSelector:@selector(numberOfSectionsInCollectionView:)]) {
+ return [__dataSource numberOfSectionsInCollectionView:self];
}
return 1;
@@ -180,32 +170,32 @@ - (NSUInteger)numberOfSections {
- (UIView *)backgroundView {
- return _tableView.backgroundView;
+ return super.backgroundView;
}
- (void)setBackgroundView:(UIView *)background {
- _tableView.backgroundView = background;
+ super.backgroundView = background;
}
- (UIView *)collectionHeaderView {
- return _tableView.tableHeaderView;
+ return super.tableHeaderView;
}
- (void)setCollectionHeaderView:(UIView *)collectionHeaderView {
- _tableView.tableHeaderView = collectionHeaderView;
+ super.tableHeaderView = collectionHeaderView;
}
- (UIView *)collectionFooterView {
- return _tableView.tableFooterView;
+ return super.tableFooterView;
}
- (void)setCollectionFooterView:(UIView *)collectionFooterView {
- _tableView.tableFooterView = collectionFooterView;
+ super.tableFooterView = collectionFooterView;
}
@@ -256,12 +246,12 @@ - (NSArray *)indexPathsForVisibleRows {
- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(SSCollectionViewScrollPosition)scrollPosition animated:(BOOL)animated {
NSIndexPath *cellIndexPath = [self _cellIndexPathFromItemIndexPath:indexPath];
- [_tableView scrollToRowAtIndexPath:cellIndexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:animated];
+ [super scrollToRowAtIndexPath:cellIndexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:animated];
}
- (UIScrollView *)scrollView {
- return _tableView;
+ return self;
}
@@ -269,8 +259,8 @@ - (UIScrollView *)scrollView {
- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(SSCollectionViewScrollPosition)scrollPosition {
// Notify delegate that it will select
- if ([self.delegate respondsToSelector:@selector(collectionView:willSelectItemAtIndexPath:)]) {
- [self.delegate collectionView:self willSelectItemAtIndexPath:indexPath];
+ if ([__delegate respondsToSelector:@selector(collectionView:willSelectItemAtIndexPath:)]) {
+ [__delegate collectionView:self willSelectItemAtIndexPath:indexPath];
}
// Select
@@ -285,16 +275,16 @@ - (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated s
}
// Notify delegate that it did selection
- if ([self.delegate respondsToSelector:@selector(collectionView:didSelectItemAtIndexPath:)]) {
- [self.delegate collectionView:self didSelectItemAtIndexPath:indexPath];
+ if ([__delegate respondsToSelector:@selector(collectionView:didSelectItemAtIndexPath:)]) {
+ [__delegate collectionView:self didSelectItemAtIndexPath:indexPath];
}
}
- (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated {
// Notify delegate that it will deselect
- if ([self.delegate respondsToSelector:@selector(collectionView:willDeselectItemAtIndexPath:)]) {
- [self.delegate collectionView:self willDeselectItemAtIndexPath:indexPath];
+ if ([__delegate respondsToSelector:@selector(collectionView:willDeselectItemAtIndexPath:)]) {
+ [__delegate collectionView:self willDeselectItemAtIndexPath:indexPath];
}
// Deselect
@@ -303,8 +293,8 @@ - (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
[item setSelected:NO animated:YES];
// Notify delegate that it did deselection
- if ([self.delegate respondsToSelector:@selector(collectionView:didDeselectItemAtIndexPath:)]) {
- [self.delegate collectionView:self didDeselectItemAtIndexPath:indexPath];
+ if ([__delegate respondsToSelector:@selector(collectionView:didDeselectItemAtIndexPath:)]) {
+ [__delegate collectionView:self didDeselectItemAtIndexPath:indexPath];
}
}
@@ -312,7 +302,7 @@ - (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
#pragma mark - Inserting, Deleting, and Moving Items and Sections
- (void)beginUpdates {
- [_tableView beginUpdates];
+ [super beginUpdates];
// TODO: This should be thread safe and it currently is not
if (!_updates) {
@@ -378,7 +368,7 @@ - (void)endUpdates {
if (rowsDelta > 0) {
for (NSInteger i = 1; i <= rowsDelta; i++) {
NSArray *indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:rows + i inSection:sectionIndex]];
- [_tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
+ [super insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
}
}
@@ -386,7 +376,7 @@ - (void)endUpdates {
else {
for (NSInteger i = rowsDelta; i > 0; i--) {
NSArray *indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:rows - i inSection:sectionIndex]];
- [_tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation];
+ [super deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation];
}
}
}
@@ -398,7 +388,7 @@ - (void)endUpdates {
NSInteger topRow = [self _cellIndexPathFromItemIndexPath:[NSIndexPath indexPathForRow:topIndex inSection:sectionIndex]].row;
for (NSInteger i = topRow; i < rows + rowsDelta; i++) {
NSArray *indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:i inSection:sectionIndex]];
- [_tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];
+ [super reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];
}
}
}
@@ -406,7 +396,7 @@ - (void)endUpdates {
[sections release];
// Apply updates
- [_tableView endUpdates];
+ [super endUpdates];
// Clean up internal representation
[_updates removeObjectAtIndex:_updatesDepth];
@@ -447,12 +437,12 @@ - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths withItemAnimation:(SSColle
- (void)insertSections:(NSIndexSet *)sections withItemAnimation:(SSCollectionViewItemAnimation)animation {
- [_tableView insertSections:sections withRowAnimation:(UITableViewRowAnimation)animation];
+ [super insertSections:sections withRowAnimation:(UITableViewRowAnimation)animation];
}
- (void)deleteSections:(NSIndexSet *)sections withItemAnimation:(SSCollectionViewItemAnimation)animation {
- [_tableView deleteSections:sections withRowAnimation:(UITableViewRowAnimation)animation];
+ [super deleteSections:sections withRowAnimation:(UITableViewRowAnimation)animation];
}
@@ -464,7 +454,7 @@ - (void)reloadData {
}
[_sectionCache removeAllObjects];
- [_tableView reloadData];
+ [super reloadData];
if (_extremitiesStyle == SSCollectionViewExtremitiesStyleScrolling) {
@@ -481,7 +471,7 @@ - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths {
[rowIndexPaths addObject:rowIndexPath];
}
}];
- [_tableView reloadRowsAtIndexPaths:rowIndexPaths withRowAnimation:UITableViewRowAnimationFade];
+ [super reloadRowsAtIndexPaths:rowIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[rowIndexPaths release];
}
@@ -489,35 +479,35 @@ - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths {
#pragma mark - Accessing Drawing Areas of the Collection View
- (CGRect)rectForSection:(NSUInteger)section {
- return [_tableView rectForSection:(NSInteger)section];
+ return [super rectForSection:(NSInteger)section];
}
- (CGRect)rectForFooterInSection:(NSUInteger)section {
- return [_tableView rectForFooterInSection:(NSInteger)section];
+ return [super rectForFooterInSection:(NSInteger)section];
}
- (CGRect)rectForHeaderInSection:(NSUInteger)section {
- return [_tableView rectForSection:(NSInteger)section];
+ return [super rectForSection:(NSInteger)section];
}
#pragma mark - Managing the Delegate and the Data Source
-- (void)setDataSource:(id<SSCollectionViewDataSource>)dataSource {
- _dataSource = dataSource;
+- (void)setCollectionDataSource:(id<SSCollectionViewDataSource>)dataSource {
+ __dataSource = dataSource;
- if (_delegate && _dataSource) {
+ if (__delegate && __dataSource) {
[self reloadData];
}
}
-- (void)setDelegate:(id<SSCollectionViewDelegate>)delegate {
- _delegate = delegate;
+- (void)setCollectionDelegate:(id<SSCollectionViewDelegate>)delegate {
+ __delegate = delegate;
- if (_delegate && _dataSource) {
+ if (__delegate && __dataSource) {
[self reloadData];
}
}
@@ -536,12 +526,10 @@ - (void)_initialize {
_reuseableItems = [[NSMutableDictionary alloc] init];
_sectionCache = [[NSMutableDictionary alloc] init];
- _tableView = [[SSCollectionViewTableView alloc] initWithFrame:self.bounds];
- _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [_tableView _setDataSource:self];
- [_tableView _setDelegate:self];
- [self addSubview:_tableView];
+ self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ self.separatorStyle = UITableViewCellSeparatorStyleNone;
+ [super setDataSource:self];
+ [super setDelegate:self];
}
@@ -572,12 +560,12 @@ - (CGSize)_itemSizeForSection:(NSUInteger)section {
return [size CGSizeValue];
}
- if ([_delegate respondsToSelector:@selector(collectionView:itemSizeForSection:)] == NO) {
+ if ([__delegate respondsToSelector:@selector(collectionView:itemSizeForSection:)] == NO) {
[[NSException exceptionWithName:SSCollectionViewInvalidItemSizeExceptionName reason:SSCollectionViewInvalidItemSizeExceptionReason userInfo:nil] raise];
return CGSizeZero;
}
- CGSize itemSize = [_delegate collectionView:self itemSizeForSection:section];
+ CGSize itemSize = [__delegate collectionView:self itemSizeForSection:section];
if (CGSizeEqualToSize(itemSize, CGSizeZero)) {
[[NSException exceptionWithName:SSCollectionViewInvalidItemSizeExceptionName reason:SSCollectionViewInvalidItemSizeExceptionReason userInfo:nil] raise];
return CGSizeZero;
@@ -659,7 +647,7 @@ - (NSArray *)_itemsForRowIndexPath:(NSIndexPath *)rowIndexPath {
for (NSUInteger i = startIndex; i < endIndex; i++) {
NSIndexPath *itemIndexPath = [NSIndexPath indexPathForRow:i inSection:rowIndexPath.section];
- SSCollectionViewItem *item = [_dataSource collectionView:self itemForIndexPath:itemIndexPath];
+ SSCollectionViewItem *item = [__dataSource collectionView:self itemForIndexPath:itemIndexPath];
if (item == nil) {
NSException *exception = [NSException exceptionWithName:kSSCollectionViewNilItemExceptionName
reason:kSSCollectionViewNilItemExceptionReason userInfo:nil];
@@ -727,15 +715,15 @@ - (UIView *)_extremityViewForSection:(NSUInteger)section type:(SSCollectionViewC
if (!extremity) {
// Header
if (isHeader) {
- if ([_delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
- extremity = [_delegate collectionView:self viewForHeaderInSection:section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
+ extremity = [__delegate collectionView:self viewForHeaderInSection:section];
}
}
// Footer
else {
- if ([_delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
- extremity = [_delegate collectionView:self viewForFooterInSection:section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
+ extremity = [__delegate collectionView:self viewForFooterInSection:section];
}
}
@@ -811,7 +799,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
// Extremities
if (cellType != SSCollectionViewCellTypeRow) {
- SSCollectionViewExtremityTableViewCell *cell = (SSCollectionViewExtremityTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:extremityCellIdentifier];
+ SSCollectionViewExtremityTableViewCell *cell = (SSCollectionViewExtremityTableViewCell *)[super dequeueReusableCellWithIdentifier:extremityCellIdentifier];
if (!cell) {
cell = [[[SSCollectionViewExtremityTableViewCell alloc] initWithReuseIdentifier:extremityCellIdentifier] autorelease];
}
@@ -822,7 +810,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
// Normal row
- SSCollectionViewItemTableViewCell *cell = (SSCollectionViewItemTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:itemCellIdentifier];
+ SSCollectionViewItemTableViewCell *cell = (SSCollectionViewItemTableViewCell *)[super dequeueReusableCellWithIdentifier:itemCellIdentifier];
if (!cell) {
cell = [[[SSCollectionViewItemTableViewCell alloc] initWithReuseIdentifier:itemCellIdentifier] autorelease];
cell.collectionView = self;
@@ -863,8 +851,8 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
// If scrolling extremity style, don't use table view's header since we will draw it in a cell
if (_extremitiesStyle == SSCollectionViewExtremitiesStyleScrolling) {
// Hit delegate and cache result for use later
- if ([_delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
- UIView *view = [_delegate collectionView:self viewForHeaderInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
+ UIView *view = [__delegate collectionView:self viewForHeaderInSection:(NSUInteger)section];
[self _setSectionInfoItem:view forKey:kSSCollectionViewSectionHeaderViewKey section:(NSUInteger)section];
}
@@ -872,8 +860,8 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
}
// If the collection view's delegate provides a header, forward it to the table view
- if ([_delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
- return [_delegate collectionView:self viewForHeaderInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForHeaderInSection:)]) {
+ return [__delegate collectionView:self viewForHeaderInSection:(NSUInteger)section];
}
// Default to none
@@ -886,16 +874,16 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
if (_extremitiesStyle == SSCollectionViewExtremitiesStyleScrolling) {
// Hit delegate and cache result for use later
- if ([_delegate respondsToSelector:@selector(collectionView:heightForHeaderInSection:)]) {
- CGFloat height = [_delegate collectionView:self heightForHeaderInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:heightForHeaderInSection:)]) {
+ CGFloat height = [__delegate collectionView:self heightForHeaderInSection:(NSUInteger)section];
[self _setSectionInfoItem:[NSNumber numberWithFloat:height] forKey:kSSCollectionViewSectionHeaderHeightKey section:(NSUInteger)section];
}
return 0.0f;
}
// If the collection view's delegate provides a header height, forward it to the table view
- if ([_delegate respondsToSelector:@selector(collectionView:heightForHeaderInSection:)]) {
- return [_delegate collectionView:self heightForHeaderInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:heightForHeaderInSection:)]) {
+ return [__delegate collectionView:self heightForHeaderInSection:(NSUInteger)section];
}
// Default to none
@@ -908,16 +896,16 @@ - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger
if (_extremitiesStyle == SSCollectionViewExtremitiesStyleScrolling) {
// Hit delegate and cache result for use later
- if ([_delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
- UIView *view = [_delegate collectionView:self viewForFooterInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
+ UIView *view = [__delegate collectionView:self viewForFooterInSection:(NSUInteger)section];
[self _setSectionInfoItem:view forKey:kSSCollectionViewSectionFooterViewKey section:(NSUInteger)section];
}
return nil;
}
// If the collection view's delegate provides a footer, forward it to the table view
- if ([_delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
- return [_delegate collectionView:self viewForFooterInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:viewForFooterInSection:)]) {
+ return [__delegate collectionView:self viewForFooterInSection:(NSUInteger)section];
}
// Default to none
@@ -930,16 +918,16 @@ - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSIntege
if (_extremitiesStyle == SSCollectionViewExtremitiesStyleScrolling) {
// Hit delegate and cache result for use later
- if ([_delegate respondsToSelector:@selector(collectionView:heightForFooterInSection:)]) {
- CGFloat height = [_delegate collectionView:self heightForFooterInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:heightForFooterInSection:)]) {
+ CGFloat height = [__delegate collectionView:self heightForFooterInSection:(NSUInteger)section];
[self _setSectionInfoItem:[NSNumber numberWithFloat:height] forKey:kSSCollectionViewSectionFooterHeightKey section:(NSUInteger)section];
}
return 0.0f;
}
// If the collection view's delegate provides a footer height, forward it to the table view
- if ([_delegate respondsToSelector:@selector(collectionView:heightForFooterInSection:)]) {
- return [_delegate collectionView:self heightForFooterInSection:(NSUInteger)section];
+ if ([__delegate respondsToSelector:@selector(collectionView:heightForFooterInSection:)]) {
+ return [__delegate collectionView:self heightForFooterInSection:(NSUInteger)section];
}
// Default to none
@@ -964,7 +952,7 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce
}
// Forward delegate message for items if the delegate implements the delegate
- if ([_delegate respondsToSelector:@selector(collectionView:willDisplayItem:atIndexPath:)]) {
+ if ([__delegate respondsToSelector:@selector(collectionView:willDisplayItem:atIndexPath:)]) {
NSArray *items = [self _itemsForRowIndexPath:indexPath];
if (!items) {
return;
@@ -972,7 +960,7 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce
// Send for each item
for (SSCollectionViewItem *item in items) {
- [_delegate collectionView:self willDisplayItem:item atIndexPath:item.indexPath];
+ [__delegate collectionView:self willDisplayItem:item atIndexPath:item.indexPath];
}
}
}
@@ -981,50 +969,50 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
- [_delegate scrollViewDidScroll:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
+ [__delegate scrollViewDidScroll:aScrollView];
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
- [_delegate scrollViewWillBeginDragging:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
+ [__delegate scrollViewWillBeginDragging:aScrollView];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)aScrollView willDecelerate:(BOOL)decelerate {
- if ([_delegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]) {
- [_delegate scrollViewDidEndDragging:aScrollView willDecelerate:decelerate];
+ if ([__delegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]) {
+ [__delegate scrollViewDidEndDragging:aScrollView willDecelerate:decelerate];
}
}
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewWillBeginDecelerating:)]) {
- [_delegate scrollViewWillBeginDecelerating:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewWillBeginDecelerating:)]) {
+ [__delegate scrollViewWillBeginDecelerating:aScrollView];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
- [_delegate scrollViewDidEndDecelerating:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
+ [__delegate scrollViewDidEndDecelerating:aScrollView];
}
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewDidEndScrollingAnimation:)]) {
- [_delegate scrollViewDidEndScrollingAnimation:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewDidEndScrollingAnimation:)]) {
+ [__delegate scrollViewDidEndScrollingAnimation:aScrollView];
}
}
- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewShouldScrollToTop:)]) {
- return [_delegate scrollViewShouldScrollToTop:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewShouldScrollToTop:)]) {
+ return [__delegate scrollViewShouldScrollToTop:aScrollView];
}
return YES;
@@ -1032,8 +1020,8 @@ - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)aScrollView {
- (void)scrollViewDidScrollToTop:(UIScrollView *)aScrollView {
- if ([_delegate respondsToSelector:@selector(scrollViewDidScrollToTop:)]) {
- [_delegate scrollViewDidScrollToTop:aScrollView];
+ if ([__delegate respondsToSelector:@selector(scrollViewDidScrollToTop:)]) {
+ [__delegate scrollViewDidScrollToTop:aScrollView];
}
}
View
8 SSToolkit/SSCollectionViewController.m
@@ -31,8 +31,8 @@ - (id)init {
- (void)dealloc {
- _collectionView.dataSource = nil;
- _collectionView.delegate = nil;
+ _collectionView.collectionDataSource = nil;
+ _collectionView.collectionDelegate = nil;
[_collectionView release];
[super dealloc];
}
@@ -72,8 +72,8 @@ - (void)viewDidAppear:(BOOL)animated {
- (void)_initialize {
_collectionView = [[SSCollectionView alloc] initWithFrame:CGRectZero];
_collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- _collectionView.dataSource = self;
- _collectionView.delegate = self;
+ _collectionView.collectionDataSource = self;
+ _collectionView.collectionDelegate = self;
}
View
16 SSToolkit/SSCollectionViewTableView.h
@@ -1,16 +0,0 @@
-//
-// SSCollectionViewTableView.h
-// SSToolkit
-//
-// Created by Sam Soffes on 10/17/11.
-// Copyright (c) 2011 Sam Soffes. All rights reserved.
-//
-
-@class SSCollectionView;
-
-@interface SSCollectionViewTableView : UITableView
-
-- (void)_setDelegate:(SSCollectionView *)aCollectionView;
-- (void)_setDataSource:(SSCollectionView *)aCollectionView;
-
-@end
View
33 SSToolkit/SSCollectionViewTableView.m
@@ -1,33 +0,0 @@
-//
-// SSCollectionViewTableView.m
-// SSToolkit
-//
-// Created by Sam Soffes on 10/17/11.
-// Copyright (c) 2011 Sam Soffes. All rights reserved.
-//
-
-#import "SSCollectionViewTableView.h"
-
-@implementation SSCollectionViewTableView
-
-- (void)setDelegate:(id<UITableViewDelegate>)delegate {
- // Do nothing.
-}
-
-
-- (void)setDataSource:(id<UITableViewDataSource>)dataSource {
- // Do nothing.
-}
-
-
-- (void)_setDelegate:(SSCollectionView *)aCollectionView {
- [super setDelegate:(id<UITableViewDelegate>)aCollectionView];
-}
-
-
-- (void)_setDataSource:(SSCollectionView *)aCollectionView {
- [super setDataSource:(id<UITableViewDataSource>)aCollectionView];
-}
-
-
-@end

No commit comments for this range

Something went wrong with that request. Please try again.