• 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: NSImageView does not update on setNeedsDisplay
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImageView does not update on setNeedsDisplay


  • Subject: Re: NSImageView does not update on setNeedsDisplay
  • From: Nicolas Berloquin <email@hidden>
  • Date: Fri, 18 Nov 2005 17:04:00 +0100

Yep I confirm that my images only get updated when resized... unless I do the ugly business.

On 18 nov. 05, at 16:23, Eric Smith wrote:

Hi Dan.  Thanks for the reply.

I actually do call [theImage setCacheMode:NSImageCacheNever], although it doesn't help in this situation. It DOES help me in another way, however. I have two views, each displaying the same NSImage. I had to specify NSImageCacheNever in order for the <ugly> [theCell setImage:nil]</ugly> (as it was described by another list user) to work on both images. That is, if the image were cached, it would be updated in only one view.

I do not implement a drawRect function... just goes straight to the super class.

If I don't use the ugly business, the view will update the image if it is resized (this was similar to another posting I saw in the archive, but there were no replies). Seems to indicate that one or two appropriate messages to the appropriate class will cause the view to update... I just can't figure out what they are!

Thanks again,
Eric



On Nov 17, 2005, at 11:33 PM, Daniel Waylonis wrote:

On Nov 17, 2005, at 8:24 PM, Eric Smith wrote:

I've downloaded several Apple code samples, wherein an NSImageView's image is changed. After the image is changed, a simple call to [imageView setNeedsDisplay:YES] is sufficient to update the image in a GUI. However, when I do this in my code, the image is not updated in the GUI.

I'm changing the bitmap data. When I change the data, I have to get the NSImageView's cell, and do [viewCell setImage:nil]. Then I can do a [viewCell setImage:theImage], and the image will be updated in the GUI. What am I doing wrong? What needs to be done in order for an NSImageView's image to be updated in a GUI?

Hi Eric,

Quite often, NSImage will create a cached representation of your bitmap for display purposes. If you're just changing the bitmap under the covers, the NSImage doesn't know that things have changed.

You can specify:

[theImage setCacheMode:NSImageCacheNever];

and it should always use your bitmap for drawing.

Dan
-----------------------------------------------------------------
Dan Waylonis                    email@hidden
nekotech SOFTWARE
http://www.nekotech.com
650.964.2490 Voice / Fax



_______________________________________________ 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



_______________________________________________ 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
  • Follow-Ups:
    • Re: NSImageView does not update on setNeedsDisplay
      • From: Shawn Erickson <email@hidden>
References: 
 >NSImageView does not update on setNeedsDisplay (From: Eric Smith <email@hidden>)
 >Re: NSImageView does not update on setNeedsDisplay (From: Eric Smith <email@hidden>)

  • Prev by Date: Re: Automagic instantiation of singletons?
  • Next by Date: Re: How to make sure that end of string is visible in NSTextField
  • Previous by thread: Re: NSImageView does not update on setNeedsDisplay
  • Next by thread: Re: NSImageView does not update on setNeedsDisplay
  • Index(es):
    • Date
    • Thread