# Automatic view resizing in Interface Builder



## Mikuro (Nov 26, 2007)

Hi all. I'm trying to make a reusable group of views (a table and buttons for manipulating it) in Interface Builder. I've set up all my controls, grouped them within a CustomView, and made a palette out of the group. So far, great.

The problem is that I can't figure out how to resize the objects as a group within Interface Builder. I can set the autoresizing and anchor points of the subviews, but when I resize the enclosing CustomView, they don't move or resize with it.

The same thing normally happens when resizing windows, but you can hold down the Control key while resizing the window to make its content resize with it (just like resizing at runtime). That doesn't work when resizing views, though.

Is there a similar trick I can use with individual views to resize their subviews?

(I'm using IB 2.5.4, which I believe is the latest for Tiger.)


----------



## HateEternal (Dec 3, 2007)

Just after a quick look at NSView, have you looked at the documentation for -autoresizesSubviews?


----------



## Mikuro (Dec 4, 2007)

Yeah, but I didn't see anything directly related to Interface Builder. It seems like it handles that all behind the scenes, and those methods are more for changing things at runtime. I don't see any relevant checkboxes in the inspector.

Just to clarify, the only problem is within Interface Builder. Everything works as you'd expect when running it. It's just that when resizing the parent view in IB, the subviews remain static.

I guess that's just the way it is. Oh well.


----------



## HateEternal (Dec 4, 2007)

It's probably different in 2.5.4 but there is an 'Autoresizes Subviews' option in the attributes inspector in 3.0. IB 3.0 has a lot of nice new features...


----------



## Mikuro (Jan 8, 2008)

Well, I just upgraded, and it turns out Leopard's Interface Builder works just as I'd hoped: holding down Command while resizing the view will resize the subviews with it, just like when resizing windows. You can also select the "live autoresizing" menu item in the Layout menu to have it resize everything by default, without holding Command.


----------

