n-b / UIView-NibLoading

UIView category and subclass for loading content subviews from nib files.
http://bou.io/UIView-NibLoading.html
MIT License
67 stars 14 forks source link

Reconnect outlet to constraints #9

Closed n-b closed 10 years ago

n-b commented 10 years ago

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 commented 10 years ago

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.