Re: A problem of NSImageView
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