ReactiveCocoaLayout icon indicating copy to clipboard operation
ReactiveCocoaLayout copied to clipboard

Automatically derive intrinsic content size

Open jspahrsummers opened this issue 13 years ago • 2 comments

This is only a half-baked idea, but it would be cool if a view's implementation of -instrinicContentSize could somehow use the same signal chain that the view uses for laying out its subviews.

It seems like this would involve some sort of redirection, so that:

  • Live inputs – like self.rcl_boundsSignal – are zeroed out or somehow mocked, to ensure that they don't factor into the size calculations.
  • Output bindings – e.g., RAC(self.subview.frame) – are disabled, so no layout is actually performed.

jspahrsummers avatar Dec 23 '12 06:12 jspahrsummers

Trying to imagine how this would work. I tend to use intrinsic size as a minimum size for some leaf views; for example, a button with a label has some minimum size. From there, superviews' intrinsic size may be defined in terms of the intrinsic sizes of its subviews, or it may have no intrinsic size and expand to fit the frame it is laid out at.

So in my workflow at least, I would want some way to make some views have no intrinsic size, regardless of the behavior of the subviews.

Hm. Need to play with RCL some more so some of this sinks in better.

bvanderveen avatar Dec 29 '12 05:12 bvanderveen

Well, the semantics I'm talking about actually correspond to -fittingSize, but it seems like an override of -intrinsicContentSize would integrate better with Auto Layout.

In either case, this wouldn't be an automatic implementation of the method – just some way to easily grab the data you need.

jspahrsummers avatar Dec 29 '12 06:12 jspahrsummers