• 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
Scroll View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scroll View


  • Subject: Scroll View
  • From: SWC <email@hidden>
  • Date: Thu, 18 Oct 2001 23:14:26 -0400

I'm having some trouble getting my scroll view to work properly. After reading all the documentation (NSView, NSScrollView, NSClipView), I'm afraid I'm just not understanding the heirarchy of subviews well enough to determine what I need to set.

I have an image view which sits inside of a scroll view. When I open an image, I want the image view to equal the size of the image. I then want to scroll view so that the upper left part of the image is in the upper left corner of the displayed rect. I was able to get the image to scroll to the proper position, but I'm having trouble getting the content of the scroll view to be limited to the size of the image...in other words, you can scroll down and right far beyond the bottom rightmost corner of the image, which is what I want to prevent.

Here is the (some hasty) code I've got so far: (this code is right after the open panel sheet returns from the user selecting what image to open)

NSPoint thePoint = {0,0};
path = [sheet filename];
originalImage = [[NSImage alloc] initWithContentsOfFile: path];
[mainImageView setImage: originalImage];

thePoint.y = [mainImageView bounds].size.height;
[mainImageView scrollPoint:thePoint ];


Any help on this is greatly appreciated.

Spencer


  • Follow-Ups:
    • Re: Scroll View
      • From: Tim McLaren <email@hidden>
  • Prev by Date: Re: Help with pasteboard
  • Next by Date: [ANN] Cocoa SIG meeting in Houston.
  • Previous by thread: Re: run application with console or shell
  • Next by thread: Re: Scroll View
  • Index(es):
    • Date
    • Thread