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

Reconnect outlet to constraints #9

Merged
merged 3 commits into from
Oct 28, 2014
Merged

Reconnect outlet to constraints #9

merged 3 commits into from
Oct 28, 2014

Conversation

n-b
Copy link
Owner

@n-b n-b commented Oct 23, 2014

fixes #6

During loading, we replace the layout constraints to the “container view” with new constraints to the actual view. We must also update any outlets to those constraints.

I’m not entirely satisfied with my solution to list the outlets of the view (by overloading setValue:forKey:). @Codewaves’s solution (see #6) involved listing the object properties via objc_ runtime methods, which is not that great and doesn’t work with ivar outlets.

meknil and others added 3 commits October 23, 2014 21:33
Add a second example view (TwoViewsWithConfigurableSpace) to
demonstrate the reconnecting of ‘NSLayoutConstraint IBOutlets’.
There are just two black views but the space between them is
configurable via IB (property space).
When copying the view constraints from the containerView to the Nib-loaded view
also replace outlets to those old constraints with the new ones.
@n-b n-b mentioned this pull request Oct 23, 2014
@meknil
Copy link

meknil commented Oct 25, 2014

Hallo @n-b, I did check your approach today, which covers IBOutlet properties and ivars (usually not used by me).
Yes, overloading setValue looks similar strange as querying the runtime, but it works and I can accept this 'magic', because your category is very useful.

n-b added a commit that referenced this pull request Oct 28, 2014
@n-b n-b merged commit 9aabcf6 into dev Oct 28, 2014
@n-b n-b deleted the ReconnectOutletToConstraints branch October 28, 2014 12:59
@n-b n-b restored the ReconnectOutletToConstraints branch October 28, 2014 13:04
@n-b n-b deleted the ReconnectOutletToConstraints branch October 28, 2014 13:04
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

Successfully merging this pull request may close these issues.

2 participants