• 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: NSImage in a scroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage in a scroller


  • Subject: Re: NSImage in a scroller
  • From: Kent Miller <email@hidden>
  • Date: Fri, 2 Aug 2002 13:22:08 -0500

This is probably a silly question and the answer is right there in
front of me. I have a NSImageView in a NSScrollView. When I change
the image (by calling setImage) the scroller does not seem to know
about the new image. The original size of the NSImage is 256x256. The
new image is 512x512 but the scroll bars do not allow me to scroll past
256x256. What do I have to do to alert the NSScrollView that the size
of the NSImage has changed?


I finally figured out a solution and wanted to post it here in case someone needs it in the future. The solution is to call setFrame on the imageview. Something like this:

NSSize s = [image size];
NSRect r = NSMakeRect(0, 0, s.width, s.height);

[fontTextureImageView setImage:tex];
[fontTextureImageView setFrame:r];

My intuition was that when you call setImage and change the image that it should reset everything (including the frame). Well, I think the frame was being reset but possibly the correct notifications weren't being sent out to cause the scrollview to adjust. Live and Learn.

Kent
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSImage in a scroller
      • From: Marco Binder <email@hidden>
  • Prev by Date: Re: Private NIBs?
  • Next by Date: Re: Creating a clickable (web-browser-like) URL control
  • Previous by thread: NSImage in a scroller
  • Next by thread: Re: NSImage in a scroller
  • Index(es):
    • Date
    • Thread