• 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
Scrolling an NSImageView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scrolling an NSImageView


  • Subject: Scrolling an NSImageView
  • From: Daniel Todd Currie <email@hidden>
  • Date: Thu, 21 Oct 2004 00:14:56 +0900

From the docs for NSResponder:

- (void)scrollLineDown:(id)sender
Implemented by subclasses to scroll the receiver one line down in its scroll view, without changing the selection. The sender argument is typically the object that invoked this method. NSResponder declares but doesn’t implement this method.

Unfortunately, this method is also unimplemented in NSImageView. Perhaps this is because scrolling an NSImageView is a completely retarded thing to do, but I promise it is warranted in this case!

So the question is, how do I scroll my image view? I've already tried this lamentable block of code:

NSRect currentRect = [[generatorScrollView documentView] visibleRect];
Float32 scrollIncrement = [generatorScrollView verticalLineScroll];
[[generatorScrollView contentView] scrollToPoint:NSMakePoint(currentRect.origin.x, (currentRect.origin.y - scrollIncrement))];
[generatorScrollView reflectScrolledClipView:[generatorScrollView contentView]];

I'm not sure why this doesn't work, but it completely obliterates the scroller boundaries, scrolling the entire image outside of the viewable rect.

Why oh why doesn't NSScrollView implement -scrollLineDown: and other scrolling methods? Wouldn't this make sense, to have the scroll view actually manage the scrolling? The scroll view is going to have to redisplay anyway, why not have the class that is higher in the hierarchy manage the scrolling? This makes no sense.

Perhaps I should just bite the bullet and rewrite my app using a different class of document view in my scroll view, but it already works beautifully and will be a serious pain in the neck to implement using a class that actually implements -scrollLineDown:.

-- DTC
_______________________________________________
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
  • Prev by Date: Looking for local newbies
  • Next by Date: PKG creation
  • Previous by thread: Looking for local newbies
  • Next by thread: NSJavaVirtualMachine: Controlling the version of Java which is loaded
  • Index(es):
    • Date
    • Thread