Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

RBLView and requiresConstraintBasedLayout default setting #44

Open
jwilling opened this issue Oct 28, 2012 · 7 comments
Open

RBLView and requiresConstraintBasedLayout default setting #44

jwilling opened this issue Oct 28, 2012 · 7 comments
Labels

Comments

@jwilling
Copy link
Contributor

I disagree with the default setting of returning YES from requiresConstraintBasedLayout.

The method layout is called only under auto layout on 10.7, whereas on 10.8 layout is called either because auto layout is enabled, or because the view is layer-backed. As a result, apps that need to use layout-based drawing code on 10.8 yet still don't want to use auto layout are left in a bind if they want to use RBLView.

If one single view touches any part of auto layout, the whole window will fall victim to the lag that auto layout can induce, especially on table views.

What can be done about this?

@jspahrsummers
Copy link
Contributor

I would be fine with changing the default, since it was implemented before we ran into some of our own troubles with Auto Layout as well.

It'd be nice to have a consistent subview layout hook on 10.7 and 10.8, though. I've done this with -resizeSubviewsWithOldSize:, but that seems unlikely to work with views that do use Auto Layout.

@jwilling
Copy link
Contributor Author

jwilling commented Dec 9, 2012

Lets lay out what I think is happening here:

On OS X 10.8:

  • resizeSubviewsWithOldSize: is called without auto layout
  • resizeSubviewsWithOldSize: is not called with auto layout
  • layout is called without auto layout
  • layout is called with auto layout

On OS X 10.7:

  • resizeSubviewsWithOldSize: is called without auto layout
  • resizeSubviewsWithOldSize: is not called with auto layout
  • layout is not called without auto layout
  • layout is called with auto layout

Not sure where to go from here. We could do an #ifdef and enable the resizeSubviewsWithOldSize: code if we're on anything less than 10.7. Any ideas?

@jspahrsummers
Copy link
Contributor

At this point, the only thing that occurs to me is an overridable method named layoutSubviews, which is invoked from whichever layout hooks we might get (without OS conditionalizing).

That's sucky and confusing, though, and makes me think this responsibility should just lie on the user of the class.

@jwilling
Copy link
Contributor Author

jwilling commented Dec 9, 2012

I'm just desperately thinking of ways we could get rid of the enabling of constraints as that causes no end of problems.

@indragiek
Copy link
Contributor

Agree here, constraints cause a whole host of problems. Literally no existing code works with constraints layout enabled without some serious tweaking. I think either @jwilling's conditional or just diverting the layout responsibilities from RBLView to the subclass would be the best solutions.

@jspahrsummers
Copy link
Contributor

@jwilling I wasn't disagreeing with changing the default return value of that method. I just think there's no way we can compensate for it elsewhere given the shitty layout APIs.

So, let's just remove any default layout code from RBLView.

@jwilling
Copy link
Contributor Author

jwilling commented Dec 9, 2012

👍

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

No branches or pull requests

3 participants