IB 2.2 Autoresizing problems
IB 2.2 Autoresizing problems
- Subject: IB 2.2 Autoresizing problems
- From: Angela Brett <email@hidden>
- Date: Tue, 11 Jun 2002 13:04:07 +1200
Hi,
My app has a custom view in its own nib which has a number of
subviews, for selecting a search criterion. The app loads as many
copies of these view from the nib as the user wants, and they're all
put into an NSScrollView one underneath the other. This worked fine
when I first coded it (quite some time ago) but ever since I got the
December 2001 dev tools it hasn't been working quite correctly. Here
are the relevant parts of the code:
- (IBAction)moreOptions:(id)sender {
if (![NSBundle loadNibNamed:@"searchView" owner:self]) return;
//some code for storing this copy of the nib's subviews in an NSDictionary
//omitted since it's not relevant
[self resizeScrollView]; //this method just ensures the scrollView
is the right size to hold all the searchViews and shows the
scrollbars if necessary
//omitted code to get the main custom view into the newView variable
//I think I've mucked around with the order of the next few lines
with no luck...
[[scrollView documentView] setFrameSize:NSMakeSize(250
80*numberOfVisibleSearchViews)];
[[scrollView documentView] addSubview:newView];
[newView setFrameOrigin:NSMakePoint(0,0)]; //this puts the
new view below the others, which before I got the December dev tools
would move up because the view's autoresizingmask is
NSViewMinYMargin, but now they all stay at the bottom so I end up
with all the copies of the view on top of each other
//omitted code for adding buttons to add/remove search views if necessary
[[scrollView superview] display];
}
I've tried changing the view's autoresizing mask to other settings
both in the code and in IB, and I've tried changing the order of the
resizing of the scrollView's documentView and adding the new view,
and I've tried changing the 'Lock View Frame' option of the search
view in IB, but nothing works. I could get the views to be spaced out
properly if I manually changed the location of the other visible
views each time I add one, or by adding each new view at the top
instead of the bottom (which doesn't really make sense) but I would
rather know why the code which worked before I got the December dev
tools now doesn't. Perhaps it has something to do with the Lock View
Frame option that's now in IB.
Any ideas?
--
Angela Brett
email: email@hidden
Cocoa development:
http://cocoa.co.nz
homepage:
http://acronyms.co.nz/angela
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.