Re: A problem of NSImageView
Re: A problem of NSImageView
- Subject: Re: A problem of NSImageView
- From: Chris Hanson <email@hidden>
- Date: Fri, 7 Jul 2006 13:38:05 -0700
On 7/6/06, Bus Mini <email@hidden> wrote:
I have run into a problem, it seems very unreasonble. I have such
code:
NSImageView *imageView;
for(i=0;i<10;++i)
{
recevie(image);//if no data for image, this function will be
blocked.
[imageView setimage:image];
}
it is very strang that the first time I call [imageView
setimage:image]; it
make no use, and so is the second thime,the 3rd, the 4th..., until
the last
time I call [imageView setimage:image];then it set the image to
image view.
I tried to put [imageView setimage:image]; into another function,
then I
call that function, it make no use either.
How can this happen? And how can I solve this problem?
Assuming you are doing this on the main thread, this is happening
because you're never returning control to the main thread's run
loop. When you change content in views they do not update
instantly. Instead, the windows containing the views just accumulate
a dirty area, and the entire dirty area is updated at once the next
pass through the main thread's run loop by asking the views to redraw
the portion of the view that overlaps the dirty area.
You'll need to come up with a strategy to avoid blocking the main run
loop when no image data is available for you to display.
-- Chris
_______________________________________________
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