NSImage and NSView problems

Nibbie
Posts: 1
Joined: 2010.11
Post: #1
Hi, I'm having problems with resizing my NSView. When I make it smaller, it doesn't clear the old area where it was drawn. Example:
What I don't want
What I do want
I got the second image by simply shrinking the window to the dock and popping it back. That cleared the crap.
The code I'm using is:
Code:
[self setFrameSize:NSMakeSize(x,y)];
self being the NSView.

My second problem is totally unrelated... I'm trying to load a 300DPI file into an NSImage, but it seems to be scaling it to 72DPI before it draws even though I'm telling it not to change the image data
Code:
image=[NSImage imageNamed:@"test"];
[image setDataRetained:YES];
[image setCachedSeparately:YES];

Is there anything I'm doing wrong?
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #2
you could try [NSColor clearColor] then fillRect([self bounds]) to clear the NSView or if that doesnt work [self setNeedsDisplay:YES]; to redraw the view after you resize it.
Im not really sure about the second problem but did you try [image setScalesWhenResized:YES/NO]?

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  NSImage leaking? Cirdan 5 3,771 Nov 16, 2009 12:02 PM
Last Post: SethWillits
  Mouse Events in NSView Chandhu 1 4,111 Feb 28, 2008 02:08 AM
Last Post: kuon_
  Sending an NSImage on a Network mindwalkernine 1 3,089 Aug 9, 2006 04:23 AM
Last Post: djork
  Animate An NSImage mindwalkernine 1 4,169 Jun 18, 2006 12:30 AM
Last Post: StealthyCoin
  NSView loaded from bundle won't draw... Joseph Duchesne 1 3,483 Feb 12, 2006 03:33 AM
Last Post: Cochrane