Re: NSImageView does not update on setNeedsDisplay
Re: NSImageView does not update on setNeedsDisplay
- Subject: Re: NSImageView does not update on setNeedsDisplay
- From: Shawn Erickson <email@hidden>
- Date: Fri, 18 Nov 2005 10:17:42 -0800
On 11/18/05, Nicolas Berloquin <email@hidden> wrote:
> I'm using an NSImageView as a simple 'display'.
> Here's what I do : in the background thread, I may modify the image,
> I then send an event in the main loop
> (performSelectorInMainThread ...) to a method that, in the begining
> was only calling the [myImageView setNeedsDisplay: YES].
> I ended up having to pass nil then the same image back in order for
> it to work correctly. (doing a setImage with the same image
> didn't have any visible effect).
If you are not using it as a control consider instead making a simply
NSView subclass that display an image. This is trivial to do and would
avoid using a heavier weight control when all you want to do is
display an image.
Basically in your subclasses drawRect: method leverage one of the
NSImage draw/composite methods.
> I'm having the same problem in a tableview with an NSImageCell, which
> works even worst than the NSImageView. I only get updates
> when I do a reloadData. Using setNeedsDisplayInRect doesn't work for
> it (it works for the other text columns, though).
That is likely expected (not fully understanding what you are doing in
your code). The NSImageCell used by the table is attached to a column.
When the table displays itself that cell is used over and over again
but with different image data for each row that needs to be displayed.
If data changes in the data source related to your table view you will
need to tell the table that (reloadData and related ones).
_______________________________________________
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