• 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: scrolling an NSImageView leaves tracks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scrolling an NSImageView leaves tracks


  • Subject: Re: scrolling an NSImageView leaves tracks
  • From: Geoff Levner <email@hidden>
  • Date: Sun, 10 Apr 2005 01:31:27 +0200

Thanks, John. That does indeed work. It worries me, though. The solution entails drawing the image twice each time the user scrolls or resizes the window, doesn't it? Maybe I could just post a notification of my own after loading a new image... In any case it seems like a real hack. Are the artifacts due to a bug in Cocoa?

Geoff

On 9 Apr 2005, at 23:50, John Pannell wrote:

Hi Geoff-

I have successfully used the following technique to eliminate tearing artifacts when scrolling a matrix of images; I imagine it should work with a single image as well.

1. Tell the NSScrollView's NSClipView to post notifications when its bounds change.
2. Tell your controller object to observe such notifications.

[[[aScrollView subviews] objectAtIndex:0] setPostsBoundsChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollChanged:) name:nil object:[[aScrollView subviews] objectAtIndex:0]];

3. In your controller's observer method, tell the NSImageView it needs display.

[anImageView setNeedsDisplay:YES];

With any luck, this will result in "clean up" after the scrolling movement to eliminate the artifacts. Hope this helps!

John

John Pannell
Positive Spin Media
http://www.positivespinmedia.com

On Apr 9, 2005, at 1:53 PM, Geoff Levner wrote:

I have an NSImageView in an NSScrollView. I can zoom in and out, scroll, load new images, and everything is fine.

Except for one thing. Sometimes, when a newly loaded image is initially framed so that it is clipped by the scroll view, scrolling leaves tracks (grey vertical or horizontal lines) where previously clipped portions of the image become visible. Zooming in or out once makes them go away. Calling the NSClipView's setCopiesOnScroll method with NO also makes the problem go away, but then, of course, scrolling is much slower.

Has anybody out there ever encountered this sort of behavior?

_______________________________________________
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

 _______________________________________________
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

  • Follow-Ups:
    • Re: scrolling an NSImageView leaves tracks
      • From: John Pannell <email@hidden>
References: 
 >scrolling an NSImageView leaves tracks (From: Geoff Levner <email@hidden>)
 >Re: scrolling an NSImageView leaves tracks (From: John Pannell <email@hidden>)

  • Prev by Date: Re: ADC Core Data article
  • Next by Date: Re: ADC Core Data article
  • Previous by thread: Re: scrolling an NSImageView leaves tracks
  • Next by thread: Re: scrolling an NSImageView leaves tracks
  • Index(es):
    • Date
    • Thread