Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# StackView Tips
## Performance hack
### Old hack
Use a UITableViewCell's contentview. The layout will not bubble up from here. Keeps all layout restriced to that view.
Then set frame of cell.
### New Hack
Use a UIStackView, but don't use arranged Stackviews.
It has a special layer.
Add views directly as subviews and add your own constraints.
## Debugging, General Tips
- Give identifiers to constraints
- Avoid changing constraints
- Don't use updateConstraints to throw away all constraints and add them again.
- Change constraints as little as possible
- Use `[UIView _layoutDebugginIdentifier]` to identify view. Don't ship this though!
# Fastest order for updating constraints
Order of constraint changes affects speed. This is the fastest order.
Do deactivation in this order, then activate in the same order.
1. Required inequlities
2. Required equalities
3. Optional inequlities
4. Optional equalities
5. Constant Changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.