Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bluehill

macrumors newbie
Original poster
Feb 5, 2011
22
0
Please help with this......is this possible

Code:
-(void)someFunction
{
NSOperationQueue *queue = [NSOperationQueue new];
		
NSInvocationOperation *operation1 = [[NSInvocationOperation alloc] initWithTarget:self	
selector:@selector(loadframe) object:nil];

[queue addOperation:operation1];
			
[operation1 release];
[queue release];


//Use the value which has been returned from the thread 

}

-(NSString *)loadframe{
return @"Test";
}
 
Yes. If you look at the NSInvocationOperation documentation you will see there is a result method. This will contain the result of the invocation once it's complete. Note you have to wait for completion (there are a few ways of doing this, look at NSOperation, for this to be available.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.