On Wed, Dec 12, 2012, at 11:44 AM, Todd Heberlein wrote: > > On Dec 12, 2012, at 9:31 AM, Kyle Sluder <k...@ksluder.com> wrote: > > > 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. > > Thanks! > > - (void)awakeFromNib > { > [self setAutoresizingMask:NSViewNotSizable]; > } > > did the trick.
Why not just set the autoresizing mask in IB? If it's because your NIB uses auto layout, and therefore IB doesn't allow you to change the autoresizing mask of a view even if its superview is not autolayout aware (which is the case for scroll views), please file a bug. (I could've sworn I've already filed one, but I can't find it now.) > > For some reason, trying to set the mask in -initWithFrame: did not work. The Resource Programming Guide explains that only Custom Views get -initWithFrame: when loaded from nib; all other views get -initWithCoder:. <https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW19> So if your document view is a subclass of a standard framework view (for example, you dragged out a standard NSTableView from the Object Library and changed its Custom Class), don't expect to get -initWithFrame:. There is a bug in Xcode 4 whereby the Scroll View object in the Object Library doesn't contain a Custom View, but rather a plain-jane NSView. (r.10709261) You can tell an object is a Custom View because it is drawn in blue and is labeled with its Custom Class. The IB bug makes it frustrating to work with a scroll view dragged out from the library, because its document view is invisible. There is a workaround, though: instead of dragging out a Scroll View from the Object Library, drag out a Custom View and choose Editor > Embed > In Scroll View. --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