views:

44

answers:

1

I am creating an expandable view control which I would like to expand to the size of the child controls, however if I try to use the sizeToFit method nothing happens and sizeThatFits simply returns the current views size

Any suggestions?!?

A: 

You'll have to do this yourself in a subclass. It's difficult for UIView to do automatically because views can be in any position and often overlap, and there are obvious corner cases:

+--+                  +-+
|A |                  |A|       +--+
| B|    could become  |B|   or  |AB|
+--+                  +-+       +--+
tc.
Damn it I just want your first example!
tigermain
Then you have to code it yourself. UI layout is highly non-trivial.
tc.