3

i'm trying to reverse engineer the layoutSubviews function in IOS where it calculates the autosizes and contraints. Normally, if we create constraints in orders: A depends (constrained) B, B depends C, and C was inited with a fix frame, a system should need to be smart enough to realise the calculation in order: C -> B -> A to avoid unneeded loops.

My question is: How does IOS (or what is the algorithm) traverse the list of NSLayoutContraint and calculate the frame in such order?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Akito Eki
  • 151
  • 2
  • 11

1 Answers1

10

Just answering in case anyone needs it: IOS use Cassowary toolkit to do auto layout (http://www.cs.washington.edu/research/constraints/cassowary/)

Akito Eki
  • 151
  • 2
  • 11