Not exactly the same but I found this doc helpful. https://developer.apple.com/library/ios/technotes/tn2154/_index.html
Luther > On May 5, 2015, at 7:58 PM, dangerwillrobinsondan...@gmail.com wrote: > > If you have AutoLayout on in a window it's actually on for all views. > NSScrollView and its hierarchy are a bit weird though. > Thing to do is create height and width constraints for the document view and > outlets for them so you can configure them. If you're using 10.10+ you can > make them configurable in IB. > Then add a subview as your real document view. > > For upper left corner origin you need to subclass NSClipView and return YES > from an override of isFlipped. > Set the class in IB for both. > You also want to uncheck the item for translatesAutoresizingMasks > If that doesn't appear in IB you can set it in code or just return NO from a > getter override. > > Sent from my iPhone > >> On 2015/05/06, at 1:26, Jens Alfke <j...@mooseyard.com> wrote: >> >> I haven't done much AppKit work in a while. Right now I have a small app >> where I'm trying to do something very simple: put a custom NSView in a >> window and make it scrollable. The view determines its own frame size based >> on the content it needs to display. So all I did was create a new window in >> IB, add an instance of my view, embed it in an NSScrollView, and set up >> default constraints for the scroll view so it'll track the window size. >> >> It sort of works as long as the window is bigger than my custom view >> (although the view is pinned to the bottom of the window instead of the top >> for some reason.) But as soon as I resize the window to a height smaller >> than the custom view's, the view disappears and never comes back. >> >> I added an override of -setFrame: and found that my view's frame is being >> set to (0, 0, 0, 0) by AppKit while redisplaying the window. I have no idea >> why this is happening ― it probably has something to do with constraints, >> but I don't understand constraints well enough to know why (and I can't find >> any clear documentation about how to use constraints with scroll views.) How >> can I fix this? >> >> (OS X 10.10.4, Xcode 6.3.) >> >> ―Jens >> >> * thread #1: tid = 0x691af4, 0x0000000100005c08 Hops`-[RevTreeView >> setFrame:](self=0x0000610000141600, _cmd=0x00007fff8b0c9343, frame=(origin = >> (x = 0, y = 0), size = (width = 0, height = 0))) + 24 at RevTreeView.m:70, >> queue = 'com.apple.main-thread', stop reason = breakpoint 3.1 >> * frame #0: 0x0000000100005c08 Hops`-[RevTreeView >> setFrame:](self=0x0000610000141600, _cmd=0x00007fff8b0c9343, frame=(origin = >> (x = 0, y = 0), size = (width = 0, height = 0))) + 24 at RevTreeView.m:70 >> frame #1: 0x00007fff9564628f AppKit`-[NSView resizeWithOldSuperviewSize:] >> + 694 >> frame #2: 0x00007fff9574ce05 AppKit`-[NSView layoutSubtreeIfNeeded] + 810 >> frame #3: 0x00007fff95656e66 AppKit`-[NSView >> _sendViewWillDrawInRect:clipRootView:] + 47 >> frame #4: 0x00007fff957fad04 AppKit`-[NSView >> displayRectIgnoringOpacity:inContext:] + 362 >> frame #5: 0x00007fff959354cd AppKit`-[_NSMirrorDocumentView drawRect:] + >> 265 >> frame #6: 0x00007fff95676859 AppKit`-[NSView(NSInternal) >> _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] >> + 1186 >> frame #7: 0x00007fff95676278 AppKit`__46-[NSView(NSLayerKitGlue) >> drawLayer:inContext:]_block_invoke + 218 >> frame #8: 0x00007fff95675f21 AppKit`-[NSView(NSLayerKitGlue) >> _drawViewBackingLayer:inContext:drawingHandler:] + 2407 >> frame #9: 0x00007fff956755a3 AppKit`-[NSView(NSLayerKitGlue) >> drawLayer:inContext:] + 108 >> frame #10: 0x00007fff958296c6 AppKit`-[_NSBackingLayerContents >> drawLayer:inContext:] + 145 >> frame #11: 0x00007fff8a669ce7 QuartzCore`-[CALayer drawInContext:] + 119 >> frame #12: 0x00007fff958291fe AppKit`-[_NSTiledLayer drawTile:inContext:] >> + 625 >> frame #13: 0x00007fff95828f2f AppKit`-[_NSTiledLayerContents >> drawLayer:inContext:] + 169 >> frame #14: 0x00007fff8a669ce7 QuartzCore`-[CALayer drawInContext:] + 119 >> frame #15: 0x00007fff95828e70 AppKit`-[NSTileLayer drawInContext:] + 169 >> frame #16: 0x00007fff8a6683c7 QuartzCore`CABackingStoreUpdate_ + 3306 >> frame #17: 0x00007fff8a6676d7 >> QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 59 >> frame #18: 0x00007fff8a667694 QuartzCore`x_blame_allocations + 81 >> frame #19: 0x00007fff8a65b43c QuartzCore`CA::Layer::display_() + 1546 >> frame #20: 0x00007fff95828d87 AppKit`-[NSTileLayer display] + 119 >> frame #21: 0x00007fff956c2df4 AppKit`-[_NSTiledLayerContents update:] + >> 5688 >> frame #22: 0x00007fff956c14c7 AppKit`-[_NSTiledLayer display] + 375 >> frame #23: 0x00007fff8a6597fd >> QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 603 >> frame #24: 0x00007fff8a658e81 >> QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 35 >> frame #25: 0x00007fff8a658612 >> QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242 >> frame #26: 0x00007fff8a6583ae QuartzCore`CA::Transaction::commit() + 390 >> frame #27: 0x00007fff9564eae6 AppKit`-[NSWindow >> _setFrameCommon:display:stashSize:] + 3771 >> frame #28: 0x00007fff95937e73 AppKit`-[NSWindow(NSWindowResizing) >> _resizeWithEvent:] + 1469 >> frame #29: 0x00007fff957dd47c AppKit`-[NSTitledFrame mouseDown:] + 200 >> frame #30: 0x00007fff957dd3ab AppKit`-[NSThemeFrame mouseDown:] + 68 >> frame #31: 0x00007fff95d4d2fc AppKit`-[NSWindow >> _reallySendEvent:isDelayedEvent:] + 14125 >> frame #32: 0x00007fff956dcd76 AppKit`-[NSWindow sendEvent:] + 470 >> frame #33: 0x00007fff956d9312 AppKit`-[NSApplication sendEvent:] + 2504 >> frame #34: 0x00007fff95602c68 AppKit`-[NSApplication run] + 711 >> frame #35: 0x00007fff9557f354 AppKit`NSApplicationMain + 1832 >> frame #36: 0x0000000100003732 Hops`main(argc=3, argv=0x00007fff5fbff930) + >> 34 at main.m:12 >> frame #37: 0x00007fff982285c9 libdyld.dylib`start + 1 >> >> _______________________________________________ >> >> 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/dangerwillrobinsondanger%40gmail.com >> >> This email sent to dangerwillrobinsondan...@gmail.com > > _______________________________________________ > > 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/lutherbaker%40gmail.com > > This email sent to lutherba...@gmail.com _______________________________________________ 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