Solved the problem! I just had to make the custom UIView to Clip To Bounds and move the horizontal margin constraints from the custom NIB to the UIView in the view controller.