A simple question about nsthread
A simple question about nsthread
- Subject: A simple question about nsthread
- From: Andrea Salomoni <email@hidden>
- Date: Thu, 1 Dec 2005 09:40:16 +0100
Hi to all,
I wrote a very simple app as exercise.
I have two classes, in the first one (the controller of the app) I
have an action like this:
-(id)init
{
[super init];
theClass * myObject = [[theClass alloc]init];
return self;
}
-(IBAction)doSomething:(id)sender
{
[NSThread detachNewTrheadSelector:@selector(firstMethod:)
toTarget:myObject withObject:nil];
}
I have a second class (theClass)
-(void)firstMethod:(id)owner
{
NSAutoreleasePool * myPool = [[NSAutoreleasePool alloc]init];
//start the tasks;
[myTextFieldOnTheGUI performSelectorOnMainThread:@selector
(setStringValue:) withObject@"aString" waitUntilDone:NO];
[myPool release];
}
The problem is that the thread starts and all works fine, but the GUI
isn't affected by performSelectorOnMainThread: method.
I read all the doc about safe and not safe object and about NSString
the doc says to use performSelectorOnMainThread: method as I did....
I read about NSLock, NSConditionLock but don't think that locks or
mutex locks may help about it.... I think this is a cocoa conceptual
problem... maybe I missed something about that method.
I read about distributed object ... but it seems that distributed
object are used much more for network apps.
All Outlets are connected and if I put the method
performSelectorOnMainThread in the controller class all works (but
inside another thread).
Is there anyone may explain me what happen on this app?
Thank you all for big support
Andrea
_______________________________________________
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