Re: setNeedsDisplayInRect and performSelectorOnMainThread?
Re: setNeedsDisplayInRect and performSelectorOnMainThread?
- Subject: Re: setNeedsDisplayInRect and performSelectorOnMainThread?
- From: dorian <email@hidden>
- Date: Sat, 20 Jan 2007 16:20:26 -0800 (PST)
Ah, alright. That worked great. I assumed that was how to do it from my
experiences with key-value coding, but now realize that's a totally
different beast.
Thanks for the help, and sorry about the duplicate mail!
--- Julien Jalon <email@hidden> wrote:
> setNeedsDisplayInRect: requests a NSRect as an argument, not a an
> NSValue encapsulating an NSRect.
>
> Of course, you can't pass the NSRect directly to
> performSelectorOnMainThread.
>
> So you will have to implement something like
> setNeedsDisplayInRectAsValue: and use that.
>
> --
> Julien
>
> On 1/21/07, dorian <email@hidden> wrote:
> > I'm doing a multithreaded application which draws based on incoming
> > network packets (each socket draws to its own view).
> >
> > The threading docs recommend using performSelectorOnMainThread: for
> any
> > setNeedsDisplay: type of calls that are needed from outside the main
> > thread, so I am doing that.
> >
> > This works fine for setNeedsDisplay (v is the view):
> > [v performSelectorOnMainThread:@selector(setNeedsDisplay:)
> > withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO];
> >
> >
> > However, when I use it for setNeedsDisplayInRect, the display isn't
> > updated (v is the view, r is a valid rect):
> >
> > [v performSelectorOnMainThread:@selector(setNeedsDisplayInRect:)
> > withObject:[NSValue valueWithRect:r] waitUntilDone:NO];
> >
> >
> > Any idea why this isn't working as expected? Replacing the instances
> of
> > setNeedsDisplayInRect with setNeedsDisplay makes it function, but it
> seems
> > to slow it down, so I'd like to get the inRect code working.
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Don't pick lemons.
> > See all the new 2007 cars at Yahoo! Autos.
> > http://autos.yahoo.com/new_cars.html
> > _______________________________________________
> >
> > Cocoa-dev mailing list (email@hidden)
> >
> > Do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
> >
>
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden