I have a method with multiple variables:
-(void) showImg:(UIBarButtonItem *)sender string1:(NSString *) string2:(NSString *);
I want to send NSString values (As this function is used for multiple elements).
This is how I add my action when no parameters are needed:
[myButton addTarget:self action:@selector(showImg) forControlEvents: UIControlEventTouchUpInside];
I tried adding parameters within the @selector like this:
[myButton performSelector @selector(showImg:string1:string2::) withObject:@"-1" withObject:@"-1"];
But this does not work. How may I call my function with multiple parameters directly inside the @selector?
You can make your
UIButtoncall afunctionin between (like a middle man), to control the next functions parameters.