In article <google.com>,
fr (Loic BERTRAND) wrote:
You have two ways to deal with the image being smaller than the frame.
One is to make sure that never happens by always resizing the window to
be at most as large as your image plus the size of the scroll bars. In
your NSWindow delegate, you can get a message that allows you to control
resizing to make sure that the user can't resize larger than a certain
amount. This is what I do in a similar situation, although you may not
For centering, I can't say for sure what it would take. You may simply
be able to see if [[self superview] bounds] is larger than [self frame],
and if so, change your frame origin or your superview's bounds origin
appropriately. If that doesn't work, you may need to put your view
inside another view which resizes itself dynamically to always be at
least as large as the enclosing scroll view, and you then center
yourself inside it.
This is about as clean as it comes as far as I'm aware. There's no
checkbox or anything, but these solutions aren't too bad.