On Aug 20, 2010, at 12:13, Brian Postow wrote: > So, just to clarify, the whole hierarchy is Window> ContentView > ScrollView > > ClipView > ImageView > Image? I take the "ContentView" to mean the content > view of the window, or is there some other view between the scrollview and > the clipview?
I had to laugh when I read this -- you found yet another meaning of "content" for the discussion, so now we have 3. Here's the hierarchy, disambiguated: window (NSWindow) > window content view (NSView) > scroll view (NSScrollView) > scroll content view (NSClipView) > document view (whatever view sub-hierarchy you want, but a solitary NSImageView in this case) > document view contents (whatever you want, but NSImage in this case, not a view, just graphical stuff) The terminology actually makes sense -- the window consists of a content view, surrounded by window frame widgetry; the scroll view consists of a content view, surrounded by scroll widgetry -- but it would be less confusion-prone if the scroll content view was just called the clip view instead. > If I don't make the imageview smaller than the others (which are (almost) all > the same size), then how do I make the image smaller than the content view? [NSImage drawInRect...] with a suitably sized destination rect -- see below. As I said before, you can't do this with a standard NSImageView -- you do it within 'drawRect:' of a custom NSView. > But then I have to manually draw my image into the view and keep track of > that myself.... I *DO* have an image (NSImage, CGImageRef, bitmap, SOMETHING) It's as simple as: [myImage drawInRect: dstRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; You do have to calculate dstRect first. Its size comes from [myImage size] combined with the current display scale factor. Its origin should be chosen to position the image so as to occupy the entire view, OR as desired within the view *when it's smaller than the view*. Note that the image is never larger than the view -- you always size the view to be at least as large as the image, so that the scroll bars, in traversing the entire view, also traverse the entire image. _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com