2533 Views 1 Reply Latest reply: Jan 25, 2011 11:07 PM by RayNewbie
Currently Being ModeratedJan 25, 2011 11:07 PM (in response to m_userName)
I would expect this code to cause the view's frame to increase so that it encloses the subview, but it remains the same.
[sizeToFit|http://developer.apple.com/library/ios/documentation/UIKit/Reference/ UIViewClass/UIView/UIView.html#//appleref/doc/uid/TP40006816-CH3-SW11] won't change the size of a vanilla UIView object because the default implementation of [sizeThatFits:|http://developer.apple.com/library/ios/documentation/UIKit/Refer ence/UIViewClass/UIView/UIView.html#//appleref/doc/uid/TP40006816-CH3-SW16] just returns the view's current bounds. To do what you want, you'd need to override sizeThatFits in a custom subclass of UIView. In other words, UIView doesn't really know how to make a size that fits, it just provides the sizeThatFits method for the programmer to make that calculation.
\- RayiMac, Mac OS X (10.5.8)