I\'m having a problem when using addSubview.
Example code:
ParentView *myParentView = [[ParentView alloc] initWithNibName:@\"ParentView \" bundle:nil
Tested in Xcode 9.4, Swift 4 Another way to solve this issue is , You can add
override func layoutSubviews() { self.frame = (self.superview?.bounds)! }
in subview class.