YIVariableViewSize 1.0.2

How to use

YIVariableViewSize is actually an abstract concept written as ObjC-protocol style.
Thus, your job is to conform your UIView subclass to <YIVariableViewSize> protocol and implement its methods something like this:

Notice that -sizeThatFits: actually calculates subview's size, position, and lastly paddingBottom(Right), where -layoutSubviews will only handle their positioning. By doing so, we can split the resizing and positioning code, and never try to resize subview's content on -layoutSubviews, which is performance-critical.

So far so good. But you can even omit writing -sizeThatFits: and -layoutSubviews if you call [YIVariableViewSize install] in your AppDelegate.