Make example compile and run on iOS 5.x #14

Open
wants to merge 1 commit into
from

2 participants

@chrisballinger

I made the example compile for iOS 5.x but there are some horrible problems with it (it springs back to the top when you try to scroll down).

@carsonb
Owner

Hi there,

Thanks for this! We've been using it in an internal project, and over the course of the few months, the API has really changed. See some of my comments in-line.

@carsonb carsonb commented on the diff Jan 21, 2013
PSCollectionView.m
*stop = YES;
}
}];
}];
PSCollectionViewCell *cell = selectedCell.visibleCell;
- if (cell) {
+ if (cell && [self.collectionViewDelegate respondsToSelector:@selector(collectionView:didSelectView:atIndexPath:)]) {
@carsonb
Owner
carsonb added a line comment Jan 21, 2013

Excellent catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@carsonb carsonb commented on the diff Jan 21, 2013
PSCollectionView.m
@@ -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]];
@carsonb
Owner
carsonb added a line comment Jan 21, 2013

indexPathForRow:inSection doesn't quite make sense due to there being multiple items horizontally (in one "row"). We use indexPathForItem: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.html

@chrisballinger
chrisballinger added a line comment Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment