On Dec 12, 2012, at 9:23 AM, Todd Heberlein <todd_heberl...@mac.com> wrote:
> Very basic question: > > When I have an NSScrollView, when I resize the window (which resizes the > NSScrollView), the NSScrollView's documentView (my NSView subclass) gets > resized. > > I didn't expect that to happen. I thought the documentView's size would > remain constant and the scrollbars would change to reflect the difference > between the contentView and the DocumentView's sizes. What's the autoresizing mask on your document view? Even though your document view is the subview of a scroll view, it still gets -resizeWithOldSuperviewSize: as normal. If your autoresizing mask had the width- or height-sizable bits set, it will grow with the superview. > > I've overridden the > - (void)setFrameSize:(NSSize)newSize > method and just don't send the newSize to the superclass. > > Is this the right or wrong way to keep my NSVIew subclass's size constant? Am > I violating some Cocoa pattern doing it this way? Overriding -setFrameSize: to refuse to call super (or to call it with a different value) is just going to make your life confusing later on. Also, on 10.7 and earlier, -setFrameSize: is responsible for matching the view's geometry to that of its backing layer if layer-backing is enabled for that view. Failing to invoke super's implementation will lead to drawing artifacts. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com