forked from ptshih/PSCollectionView
-
Notifications
You must be signed in to change notification settings - Fork 3
Make example compile and run on iOS 5.x #14
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
Open
chrisballinger
wants to merge
1
commit into
carsonb:master
Choose a base branch
from
chrisballinger:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,10 @@ | |
| 28C66827156F3E84008E82CF /* PSCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C66824156F3E84008E82CF /* PSCollectionView.m */; }; | ||
| 28C66828156F3E84008E82CF /* PSCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C66826156F3E84008E82CF /* PSCollectionViewCell.m */; }; | ||
| 28C6682C156F4073008E82CF /* PSBroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C6682B156F4073008E82CF /* PSBroView.m */; }; | ||
| D9DDFAE816AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = D9DDFAE316AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.m */; }; | ||
| D9DDFAE916AB2C5500350F2B /* PSCollectionViewLayoutAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = D9DDFAE516AB2C5500350F2B /* PSCollectionViewLayoutAttributes.m */; }; | ||
| D9DDFAEA16AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = D9DDFAE716AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.m */; }; | ||
| D9DDFAEC16AB2C6000350F2B /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D9DDFAEB16AB2C6000350F2B /* [email protected] */; }; | ||
| /* End PBXBuildFile section */ | ||
|
|
||
| /* Begin PBXFileReference section */ | ||
|
|
@@ -42,6 +46,13 @@ | |
| 28C66826156F3E84008E82CF /* PSCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSCollectionViewCell.m; path = ../PSCollectionViewCell.m; sourceTree = "<group>"; }; | ||
| 28C6682A156F4073008E82CF /* PSBroView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSBroView.h; sourceTree = "<group>"; }; | ||
| 28C6682B156F4073008E82CF /* PSBroView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSBroView.m; sourceTree = "<group>"; }; | ||
| D9DDFAE216AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSCollectionViewItemLayoutAttributes.h; path = ../PSCollectionViewItemLayoutAttributes.h; sourceTree = "<group>"; }; | ||
| D9DDFAE316AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSCollectionViewItemLayoutAttributes.m; path = ../PSCollectionViewItemLayoutAttributes.m; sourceTree = "<group>"; }; | ||
| D9DDFAE416AB2C5500350F2B /* PSCollectionViewLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSCollectionViewLayoutAttributes.h; path = ../PSCollectionViewLayoutAttributes.h; sourceTree = "<group>"; }; | ||
| D9DDFAE516AB2C5500350F2B /* PSCollectionViewLayoutAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSCollectionViewLayoutAttributes.m; path = ../PSCollectionViewLayoutAttributes.m; sourceTree = "<group>"; }; | ||
| D9DDFAE616AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSCollectionViewSectionViewLayoutAttributes.h; path = ../PSCollectionViewSectionViewLayoutAttributes.h; sourceTree = "<group>"; }; | ||
| D9DDFAE716AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSCollectionViewSectionViewLayoutAttributes.m; path = ../PSCollectionViewSectionViewLayoutAttributes.m; sourceTree = "<group>"; }; | ||
| D9DDFAEB16AB2C6000350F2B /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
| /* End PBXFileReference section */ | ||
|
|
||
| /* Begin PBXFrameworksBuildPhase section */ | ||
|
|
@@ -61,6 +72,7 @@ | |
| 28C667F4156F3E60008E82CF = { | ||
| isa = PBXGroup; | ||
| children = ( | ||
| D9DDFAEB16AB2C6000350F2B /* [email protected] */, | ||
| 28C66829156F3E88008E82CF /* PSCollectionView */, | ||
| 28C66809156F3E60008E82CF /* BroBoard */, | ||
| 28C66802156F3E60008E82CF /* Frameworks */, | ||
|
|
@@ -116,6 +128,12 @@ | |
| 28C66829156F3E88008E82CF /* PSCollectionView */ = { | ||
| isa = PBXGroup; | ||
| children = ( | ||
| D9DDFAE216AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.h */, | ||
| D9DDFAE316AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.m */, | ||
| D9DDFAE416AB2C5500350F2B /* PSCollectionViewLayoutAttributes.h */, | ||
| D9DDFAE516AB2C5500350F2B /* PSCollectionViewLayoutAttributes.m */, | ||
| D9DDFAE616AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.h */, | ||
| D9DDFAE716AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.m */, | ||
| 28C66823156F3E84008E82CF /* PSCollectionView.h */, | ||
| 28C66824156F3E84008E82CF /* PSCollectionView.m */, | ||
| 28C66825156F3E84008E82CF /* PSCollectionViewCell.h */, | ||
|
|
@@ -178,6 +196,7 @@ | |
| 28C6680E156F3E60008E82CF /* InfoPlist.strings in Resources */, | ||
| 28C6681A156F3E60008E82CF /* PSViewController_iPhone.xib in Resources */, | ||
| 28C6681D156F3E60008E82CF /* PSViewController_iPad.xib in Resources */, | ||
| D9DDFAEC16AB2C6000350F2B /* [email protected] in Resources */, | ||
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| }; | ||
|
|
@@ -194,6 +213,9 @@ | |
| 28C66827156F3E84008E82CF /* PSCollectionView.m in Sources */, | ||
| 28C66828156F3E84008E82CF /* PSCollectionViewCell.m in Sources */, | ||
| 28C6682C156F4073008E82CF /* PSBroView.m in Sources */, | ||
| D9DDFAE816AB2C5500350F2B /* PSCollectionViewItemLayoutAttributes.m in Sources */, | ||
| D9DDFAE916AB2C5500350F2B /* PSCollectionViewLayoutAttributes.m in Sources */, | ||
| D9DDFAEA16AB2C5500350F2B /* PSCollectionViewSectionViewLayoutAttributes.m in Sources */, | ||
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| }; | ||
|
|
@@ -232,6 +254,7 @@ | |
| buildSettings = { | ||
| ALWAYS_SEARCH_USER_PATHS = NO; | ||
| ARCHS = "$(ARCHS_STANDARD_32_BIT)"; | ||
| CLANG_ENABLE_OBJC_ARC = YES; | ||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| COPY_PHASE_STRIP = NO; | ||
| GCC_C_LANGUAGE_STANDARD = gnu99; | ||
|
|
@@ -257,6 +280,7 @@ | |
| buildSettings = { | ||
| ALWAYS_SEARCH_USER_PATHS = NO; | ||
| ARCHS = "$(ARCHS_STANDARD_32_BIT)"; | ||
| CLANG_ENABLE_OBJC_ARC = YES; | ||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| COPY_PHASE_STRIP = YES; | ||
| GCC_C_LANGUAGE_STANDARD = gnu99; | ||
|
|
@@ -278,6 +302,7 @@ | |
| GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| GCC_PREFIX_HEADER = "BroBoard/BroBoard-Prefix.pch"; | ||
| INFOPLIST_FILE = "BroBoard/BroBoard-Info.plist"; | ||
| IPHONEOS_DEPLOYMENT_TARGET = 5.0; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| WRAPPER_EXTENSION = app; | ||
| }; | ||
|
|
@@ -289,6 +314,7 @@ | |
| GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||
| GCC_PREFIX_HEADER = "BroBoard/BroBoard-Prefix.pch"; | ||
| INFOPLIST_FILE = "BroBoard/BroBoard-Info.plist"; | ||
| IPHONEOS_DEPLOYMENT_TARGET = 5.0; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| WRAPPER_EXTENSION = app; | ||
| }; | ||
|
|
@@ -313,6 +339,7 @@ | |
| 28C66822156F3E60008E82CF /* Release */, | ||
| ); | ||
| defaultConfigurationIsVisible = 0; | ||
| defaultConfigurationName = Release; | ||
| }; | ||
| /* End XCConfigurationList section */ | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -453,8 +453,8 @@ - (void)performLayout | |
| NSMutableArray *sectionItems = _sectionItems[sectionNumber]; | ||
| [sectionItems enumerateObjectsUsingBlock:^(PSCollectionViewItemLayoutAttributes *itemAttributes, NSUInteger idx, BOOL *stop) { | ||
| if (itemAttributes.valid == NO) { | ||
| NSIndexPath *indexPath = [NSIndexPath indexPathForItem:idx inSection:section]; | ||
| NSIndexPath *indexPath = [NSIndexPath indexPathForRow:idx inSection:section]; | ||
| //ensure we have the height for this item | ||
| CGFloat height = itemAttributes.frame.size.height; | ||
| if (height == 0.0f) { | ||
|
|
@@ -500,7 +500,7 @@ - (void)performLayout | |
| itemAttributes.visibleCell = nil; | ||
| } else if (visibleCell && itemAttributes.visibleCell == nil) { | ||
| //Cell is now visible, add it in | ||
| NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:[sectionNumber integerValue]]; | ||
| NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:[sectionNumber integerValue]]; | ||
| PSCollectionViewCell *newCell = [self.collectionViewDataSource collectionView:self viewAtIndexPath:indexPath]; | ||
| itemAttributes.visibleCell = newCell; | ||
| [self addSubview:newCell]; | ||
|
|
@@ -826,14 +826,14 @@ - (void)didSelectView:(UITapGestureRecognizer *)gestureRecognizer | |
| [sectionItems enumerateObjectsUsingBlock:^(PSCollectionViewItemLayoutAttributes *candidate, NSUInteger idx, BOOL *stop) { | ||
| if (candidate.valid && CGRectContainsPoint(candidate.frame, tapPoint)) { | ||
| selectedCell = candidate; | ||
| selectedIndexPath = [NSIndexPath indexPathForItem:idx inSection:[sectionNumber integerValue]]; | ||
| selectedIndexPath = [NSIndexPath indexPathForRow:idx inSection:[sectionNumber integerValue]]; | ||
| *stop = YES; | ||
| } | ||
| }]; | ||
| }]; | ||
|
|
||
| PSCollectionViewCell *cell = selectedCell.visibleCell; | ||
| if (cell) { | ||
| if (cell && [self.collectionViewDelegate respondsToSelector:@selector(collectionView:didSelectView:atIndexPath:)]) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent catch! |
||
| [self.collectionViewDelegate collectionView:self didSelectView:cell atIndexPath:selectedIndexPath]; | ||
| } | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indexPathForRow:inSectiondoesn't quite make sense due to there being multiple items horizontally (in one "row"). We useindexPathForItem:inSection:to conform similarly to how UICollectionView does. The PSViewController in the BroBoard example seems to still use the row property, when really it should be using the item property instead. See: http://developer.apple.com/library/ios/#documentation/uikit/reference/NSIndexPath_UIKitAdditions/Reference/Reference.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. Unfortunately indexPathForItem doesn't run on iOS 5.x devices. :(
I ended up switching to
https://github.com/steipete/PSTCollectionViewbecause it is a clone of
the UICollectionView
API backported to iOS 4.3+.
On Mon, Jan 21, 2013 at 6:55 AM, Carson Brown [email protected]: