Question

I have a puzzling problem. I have a pointer to a vanilla NSView that was initialized in a nib. I messaged the NSView with:

[myNSView setFrame:NSMakeRect(0,0,816,1056)];

but when I step through the debugger, myNSView has a frame of {{0,0}, {801, 1041}}. The dimensions of the rectangle are 15 less than I've specified! This happens consistently. If I specify two [setFrames] in a row, everything works, but of course that's not the answer.

Why does setFrame fail?

Was it helpful?

Solution

15px is exactly the size of an NSScroller at NSRegularControlSize.

My guess is that you have your NSScrollView configured to automatically hide scrollers.

Try turning off the horizontal and vertical scrollers of your scrollView in the NIB, if that solves the problem, you'll know where to look from there.  It is something related to the clipView of the scrollView autoresizing the documentView. The clipView itself is being autoresized when the scrollers appear; directly after you set the documentView to a frameSize (the 100% setting I'd guess) that requires scrollers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top