How to make a subview fill its superview How to make a subview fill its superview objective-c objective-c

How to make a subview fill its superview


Seems you misunderstand the frame and bounds, revise your code to To.frame=ParentView.bounds; should be OK.

Related: Why is there an frame rectangle and an bounds rectangle in an UIView?


Fix "20 points" difference from bottom in subView and View in Swift:

To.frame = NSRect(origin: CGPoint(x: ParentView.bounds.origin.x,                                   y: ParentView.bounds.origin.y-20),                     size: ParentView.bounds.size)