Search code examples
iphonesuperview

(iphone) set subview's frame outside of superview's bound?


I noticed that I can place subview outside of superview's bound (either partly or fully).
I wonder if that's acceptable, since it seems to be abnormal in usual iphone view programming.

Thank you.


Solution

  • This is acceptable and sometimes even common practice - custom implementations of scroll views or other "composite" views, for example, commonly place or move objects outside the superview's bounds.

    You may be interested in the UIView property clipsToBounds, which restricts subview drawing to only the bounds of the superview.