• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScrollView


  • Subject: Re: NSScrollView
  • From: Jonathon Mah <email@hidden>
  • Date: Wed, 20 Apr 2005 04:16:07 +0930

On 20 Apr 2005, at 04:09, Brian O'Brien wrote:

Yes.. I think this helps.. :)
I just wanted to make sure I wasn't going down the wrong path.. (Which I've done in the past)
Right Now I have an NSView with N by M (rows/cols) subviews...
I want to be able to scroll around and see a portion of these N by M subviews...
I guess its my responsability to manage the displaying of these image based on the slider positions.. Correct?

The image view doesn't have to know it's in a scroll view. It just has to know how to display itself as it if it were being drawn alone (not in a scroll view). NSScrollView will handle clipping the drawing to the right size. Your view will receive messages like [imageView displayInRect:aRect] (or something like that), tell it that it needs to draw itself in a certain rectangle. When you first open your app, aRect will be the entire visible rectangle (the bit shown in the scroll view). As the user scrolls, aRect will be the small rectangles that are uncovered as the user scrolls the document (the bits that are just coming into view). These rectangles are, by the way, in your view's coordinate system (so a rect with origin (0,0) is the far top-left of your image view, _not_ the top-left of what's currently visible in the scroll view). So your image view doesn't need to know about the scroll bar positions or anything; it just needs to know how to draw itself for a specific rectangle.


(You /could/ redraw then entire view when asked to draw a rectangle, but that'd cause a lot of unnecessary drawing and be slow.)


Jonathon Mah email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSScrollView (From: "Brian O'Brien" <email@hidden>)
 >Re: NSScrollView (From: Jonathon Mah <email@hidden>)
 >Re: NSScrollView (From: "Brian O'Brien" <email@hidden>)

  • Prev by Date: Detecting when an app goes full screen
  • Next by Date: Re: Saving UTF-8 as File
  • Previous by thread: Re: NSScrollView
  • Next by thread: Re: NSScrollView
  • Index(es):
    • Date
    • Thread