Re: NSImage in a scroller
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.