I have a custom view controller class. I want to instantiate multiple custom view controllers and add their views to my NSStackView. I add a new view to the stack view by clicking a button. The button calls this method:
[stackView insertView:myCustomViewController.view atIndex:0 inGravity:NSStackViewGravityBottom];
However, when a new view is added, it's added stackView.spacing
below where the previous view was, but that previous view is no longer visible, however it is still listed as a view in my bottom gravity as evidenced when I call
NSLog(@"%lu",(unsigned long)[stackView viewsInGravity:NSStackViewGravityBottom].count);
I don't have this problem if I try adding NSButton
s, so it's something to do with my custom view but I can't figure out what.
Please help. Thanks!