• 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: A problem of NSImageView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A problem of NSImageView


  • Subject: Re: A problem of NSImageView
  • From: Uli Kusterer <email@hidden>
  • Date: Tue, 11 Jul 2006 00:11:04 +0200

Am 09.07.2006 um 18:18 schrieb Bus Mini:
That is

-(void)workThread:(id)param
{

  while(1)
   {

     [ImageView setImage:otherImage];

     [self getImage];

     [ImageView setImage:screenImage];
    }
}

Then I see two iamges switching, and I can see the pixel in screenImage was
modified.

You can't mess with any GUI elements from a secondary thread. Only from the main thread. Either use an NSTimer (without the loop, the timer is called repeatedly, so it already "is your loop"), or use - performSelectorOnMainThread: to send make your code happen in the main thread.


Also be careful: threads run sort of "at the same time" as other threads, so it can happen that one thread overwrites something the other thread just wrote (Any introduction to multi-threading should explain this better than I could here).

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ 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
References: 
 >Re: A problem of NSImageView (From: "Bus Mini" <email@hidden>)
 >Re: A problem of NSImageView (From: Chris Hanson <email@hidden>)
 >Re: A problem of NSImageView (From: "Bus Mini" <email@hidden>)
 >Re: A problem of NSImageView (From: "Bus Mini" <email@hidden>)

  • Prev by Date: menu bar MIA
  • Next by Date: Render DVD into GWorldPtr?
  • Previous by thread: Re: A problem of NSImageView
  • Next by thread: MOVED TO NEW VENUE: Cocoaheads Lake Forest CA on 7/11
  • Index(es):
    • Date
    • Thread