how can i pass an int value through a selector method?
This works also for an int
parameter, which is especially useful, if you are unable to change the signature of the selector you want to perform.
SEL sel = @selector(tabledata:);
NSMethodSignature *signature = [[self class] instanceMethodSignatureForSelector:sel];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
invocation.selector = sel;
// note that the first argument has index 2!
[invocation setArgument:&y atIndex:2];
// with delay
[invocation performSelector:@selector(invokeWithTarget:) withObject:self afterDelay:0.1];
The easiest solution, if you 'own' the target selector, is to wrap the int argument in an NSNumber:
-(int)tabledata:(NSNumber *)_cellnumber {
int cellnumber = [_cellnumber intValue];
....
}
To call this method you would use:
[self performselector:@selector(tabledata:) withObject:[NSNumber numberWithInt:y] afterDelay:0.1];