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

Project broken in iOS 9 #19

Open
Goles opened this issue Jun 21, 2015 · 4 comments
Open

Project broken in iOS 9 #19

Goles opened this issue Jun 21, 2015 · 4 comments

Comments

@Goles
Copy link

Goles commented Jun 21, 2015

Just for the record, UIAttachmentBehavior does not respond to indexPath.

When trying to build I'm getting:

"No known instance method for selector indexPath" compiler errors.

(maybe you know a way to go around this issue)

@DiAvisoo
Copy link

Just do a typecast to UICollectionViewLayoutAttributes where it complains about indexPath:

Example row 67:

Replace

        return [itemsIndexPathsInVisibleRectSet containsObject:
[[[behaviour items] firstObject] indexPath]] == NO;

With the following

        return [itemsIndexPathsInVisibleRectSet containsObject:
[((UICollectionViewLayoutAttributes *)[[behaviour items] firstObject]) indexPath]] == NO;

@shantanukhanwalkar
Copy link

Works for me. Should this issue be closed?

@yairsz
Copy link

yairsz commented Sep 10, 2015

There's a pull request open since June 10 fixing this issue
yairsz@1a8e850

@albertgh
Copy link

I think it is caused by the new generic feature

// Step 1: Remove any behaviours that are no longer visible.
NSArray *noLongerVisibleBehaviours = [self.dynamicAnimator.behaviors filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIAttachmentBehavior *behaviour, NSDictionary *bindings) {
    UICollectionViewLayoutAttributes *layoutAttr =
    (UICollectionViewLayoutAttributes *)(behaviour.items.firstObject);
    return [itemsIndexPathsInVisibleRectSet containsObject:layoutAttr.indexPath] == NO;
}]];

[noLongerVisibleBehaviours enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
    [self.dynamicAnimator removeBehavior:obj];

    UICollectionViewLayoutAttributes *layoutAttr =
    (UICollectionViewLayoutAttributes *)(((UIAttachmentBehavior *)obj).items.firstObject);

    NSIndexPath *indexPathNeedToRemove = layoutAttr.indexPath;

    [self.visibleIndexPathsSet removeObject:indexPathNeedToRemove];
    [self.visibleHeaderAndFooterSet removeObject:indexPathNeedToRemove];
}];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants