I need help with two things... first off, I'd like to pass i, just a C integer, as an object in an NSInvocationOperation.
Second thing... well, am I using NSOperations properly? The idea is that by using it, the interface won't become unresponsive while it's loading the data.
Here's my code:
I have set it up so that if the image hasn't been downloaded yet, it has a label "Loading..."
Edit:
Never mind, I got it to work. It seems the issue was with my signature, all I did was change
"selector: @selector(loadInfo)" to
"selector: @selector(loadInfo: )"
Mods, feel free to delete this thread... although I'm leaving it up for incase someone else ever has the same issue.
Second thing... well, am I using NSOperations properly? The idea is that by using it, the interface won't become unresponsive while it's loading the data.
Here's my code:
Code:
infoQueue = [[NSOperationQueue alloc] init];
infoQueue.maxConcurrentOperationCount = 1;
int i = 0;
for (i = 0; i < [users count]; i++)
{
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector: @selector(loadInfo) object:i];
[infoQueue addOperation: operation];
[operation release];
}
}
return self;
}
- (void)loadInfo:i
{
[userInfoArray addObject: [TwitterHelper fetchInfoForUsername: [users objectAtIndex: i]]];
[self reloadRowsAtIndexPaths:[NSArray arrayWithObject: i] withRowAnimation: UITableViewRowAnimationNone];
}
I have set it up so that if the image hasn't been downloaded yet, it has a label "Loading..."
Edit:
Never mind, I got it to work. It seems the issue was with my signature, all I did was change
"selector: @selector(loadInfo)" to
"selector: @selector(loadInfo: )"
Mods, feel free to delete this thread... although I'm leaving it up for incase someone else ever has the same issue.