• 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: Problem using NSView's scrollRect:by:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using NSView's scrollRect:by:


  • Subject: Re: Problem using NSView's scrollRect:by:
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 25 Jan 2017 23:37:23 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sSoNGoXtsO:SMTPCORP

On Jan 25, 2017, at 22:59 , Tae Won Ha <email@hidden> wrote:
>
> I've read the documentation, but I thought that to "just" copy a potion of the NSView's content to somewhere else inside the view, you don't have to do the second and third part. And I did not quite understand the second part in the doc.: what does it mean to change the origin of the view? Why do I "have to" do it? Does it mean that scrollRect:by: only works if the view is somehow embedded in a container view which "acts" like an NSScrollView?

Your “draw” method draws a red rectangle at the view origin (by default, at the top left of the view or the bottom left, depending on whether the coordinate system is flipped). That means, it’s always going to be drawn in the same place, from the user’s point of view.

What you want, presumably, is for the red rectangle to appear to move up or down when the view is scrolled. To get that effect, you must either draw it at a different place — at different view coordinates — or move the view origin to where you want the rectangle to draw.

There’s yet something else going on here, because you should at least see some of the red rectangle get redrawn in a different part of the view. Since the view doesn’t appear to change at all, that suggests:

— something is setting “needsDisplay” for the entire view, which causes your draw method to redraw the original view, wiping out the effect of the scroll method

— you might be using the scroll method to copy in the wrong direction, so that your copied bits are somewhere outside the visible portion of the view

You’re going to have to experiment to narrow down what’s wrong.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Problem using NSView's scrollRect:by:
      • From: Quincey Morris <email@hidden>
References: 
 >Problem using NSView's scrollRect:by: (From: Tae Won Ha <email@hidden>)
 >Re: Problem using NSView's scrollRect:by: (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Overriding the release mehod
  • Next by Date: Re: Overriding the release mehod
  • Previous by thread: Re: Problem using NSView's scrollRect:by:
  • Next by thread: Re: Problem using NSView's scrollRect:by:
  • Index(es):
    • Date
    • Thread