Re: performSelectorOnMainThread: problems
Re: performSelectorOnMainThread: problems
- Subject: Re: performSelectorOnMainThread: problems
- From: Scot Gellock <email@hidden>
- Date: Wed, 30 Oct 2002 19:25:16 -0800
On 10/30/02 8:42 AM, "Anthony Duer" <email@hidden> wrote:
I got this to work for me by making the method a class method. Make your
parseData method a class method.
+ (void) parseData: (NSString *)values
{
//parse data
//update palettes with images
}
Scot
>
I have a secondary thread which needs to pass data to the main thread
>
for drawing on the screen. I found a function in NSObject which seems to
>
do exactly what I need: performSelectorOnMainThread:withObject:wait:
>
However, my object doesn't seem to respond to it for some reason. It
>
inherits directly from NSObject, so shouldn't it inherit this method as
>
well?
>
>
The code looks something like:
>
>
- (void) socketRun: (NSString *)key
>
{
>
//Set up autorelease pool, connect to server
>
while(connected)
>
{
>
[mySocket readData: myData];
>
myString = [myData stringWithEncoding: UTF8];
>
[self performSelectorOnMainThread: @selector(parseData:)
>
withObject: myString wait: NO];
>
}
>
//release pool, end thread
>
}
>
>
-(void) parseData: (NSString *)values
>
{
>
//parse data
>
//update palettes with images
>
}
>
>
~Anthony Duer, going to get this thing working eventually...
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.