Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically resize NSTabView to fit content view

I have a NSTabView with a number of NSView items. I want to resize the tab view so that the displayed view always fits snugly within the tab view.

I've tried a number of variations of setFrame within the tabView's delegate didSelectTabViewItem and shouldSelectTabViewItem but can't seem to get it to work. I think I have to change the size of the tabView's contentRect, but this seems to be readonly.

Can anyone please give me a quick pointer to perhaps where this has been done before (I'm having no luck with Google).

Thanks,

John

like image 974
John Avatar asked Nov 05 '22 15:11

John


1 Answers

Ok I finally got it:

  1. In Xcode (.xib editor), check the Resize box Resize box of the container window Window inspector

  2. Click on the "tabView" and check this Autoresizes Subviews here Autoresizes Subviews panel

  3. At last simply adapt its resizing rules in the Size Inspector, that is!AutoSizing

like image 108
Flavien Volken Avatar answered Nov 11 '22 17:11

Flavien Volken