Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Automatically derive intrinsic content size #27

Open
jspahrsummers opened this issue Dec 23, 2012 · 2 comments
Open

Automatically derive intrinsic content size #27

jspahrsummers opened this issue Dec 23, 2012 · 2 comments

Comments

@jspahrsummers
Copy link
Member

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.
@bvanderveen
Copy link

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.

@jspahrsummers
Copy link
Member Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants