performSelectorOnMainThread: problems
performSelectorOnMainThread: problems
- Subject: performSelectorOnMainThread: problems
- From: Anthony Duer <email@hidden>
- Date: Wed, 30 Oct 2002 08:42:50 -0800
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.