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

UIView+FDCollapsibleConstraints problem when use XXNibBridge(2.3.0) #22

Open
dev-gao opened this issue Jun 20, 2016 · 1 comment
Open

Comments

@dev-gao
Copy link

dev-gao commented Jun 20, 2016

In XXNibBridge 2.3.0 version, create new constraints for the realView at instantiateRealViewFromPlaceholder(). It doesn't invoke setFd_collapsibleConstraints for updating collapsible constraints.
So the view's collapse action goes wrong because of the realView was not setFd_collapsibleConstraints.

@wtlucky
Copy link

wtlucky commented Jun 21, 2016

Add the several lines after the line in XXNibBridge.m

[realView addConstraint:newConstraint];
//************* This section works for UIView+FDCollapsibleConstraints
        NSMutableArray *constraints = objc_getAssociatedObject(realView, @selector(fd_collapsibleConstraints));
        if (!constraints) {
            constraints = @[].mutableCopy;
            objc_setAssociatedObject(realView, @selector(fd_collapsibleConstraints), constraints, OBJC_ASSOCIATION_RETAIN);
        }
        // Store original constant value
        objc_setAssociatedObject(newConstraint, @selector(fd_originalConstant), @(constraint.constant), OBJC_ASSOCIATION_RETAIN);
        [constraints addObject:newConstraint];

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

2 participants