FROM : Jonathon Mah
DATE : Tue Apr 19 20:07:39 2005
Hi Brian,
On 20 Apr 2005, at 03:01, Brian O'Brien wrote:
> Hi.. bit of a newbie question here...
> I have been developing an image viewer and it is a subclass of an
> NSView
> I want to have many images on the viewer and be able to scroll
> horizontally or vertically if necessary.
> I was thinking the NSScrollView may be ideal for this.. would you
> agree?
Yes, you'd definitely want to use an NSScrollView. From your wording,
though, it sounds like you may not fully understand what an
NSScrollView does (forgive me if I'm wrong, though).
A quick explanation: A scroll view is like a wrapper around another
view. Say you have some kind of view that represents a page (700x1000
pixels, say), and you can put text blocks wherever you want. On its own
it'd need a really big window to display it. So you ask Interface
Builder to make it a subview of NSScrollView, and now you can use a
smaller window. The scroll view will take care of deciding which part
of the larger view to display, and scrolling it. From the page view's
perspective, though, it knows nothing about the NSScrollView - drawing
something at 350x500 will appear in the middle of the page, not the
middle of the scroll view.
So you'd make some big view to display the images (well, the view could
start out small and grow as things are added), and just drop it into an
NSScrollView.
Hope this helps,
Jonathon Mah
<email_removed>
DATE : Tue Apr 19 20:07:39 2005
Hi Brian,
On 20 Apr 2005, at 03:01, Brian O'Brien wrote:
> Hi.. bit of a newbie question here...
> I have been developing an image viewer and it is a subclass of an
> NSView
> I want to have many images on the viewer and be able to scroll
> horizontally or vertically if necessary.
> I was thinking the NSScrollView may be ideal for this.. would you
> agree?
Yes, you'd definitely want to use an NSScrollView. From your wording,
though, it sounds like you may not fully understand what an
NSScrollView does (forgive me if I'm wrong, though).
A quick explanation: A scroll view is like a wrapper around another
view. Say you have some kind of view that represents a page (700x1000
pixels, say), and you can put text blocks wherever you want. On its own
it'd need a really big window to display it. So you ask Interface
Builder to make it a subview of NSScrollView, and now you can use a
smaller window. The scroll view will take care of deciding which part
of the larger view to display, and scrolling it. From the page view's
perspective, though, it knows nothing about the NSScrollView - drawing
something at 350x500 will appear in the middle of the page, not the
middle of the scroll view.
So you'd make some big view to display the images (well, the view could
start out small and grow as things are added), and just drop it into an
NSScrollView.
Hope this helps,
Jonathon Mah
<email_removed>
| Related mails | Author | Date |
|---|---|---|
| Brian O'Brien | Apr 19, 19:31 | |
| Jonathon Mah | Apr 19, 20:07 | |
| Brian O'Brien | Apr 19, 20:39 | |
| Jonathon Mah | Apr 19, 20:46 | |
| Mark T | Apr 20, 03:12 |






Cocoa mail archive

