I have this “observer” that watches the UISwitch for a change in value:
[cell.switcher addTarget:self action:@selector(switched:withName:) forControlEvents:UIControlEventValueChanged];
When the value is changed this method is called:
-(void)switched:(UISwitch *)switcher withName:(NSString *)name;
As you can see I have two objects which I need to pass with the first code. How do I send the object of a nsstring and a uiswitch through the method of addTarget:action:forControlEvents so that I can access them in the selector switched:withname?
Thanks,
Kevin
EDIT: I’m not very good with obj-c and didn’t really learn the terms correctly, so if I made a mistake please let me know!
Best way to go about this is to tag your UISwitch objects:
Then on your
switched:method you can test the sender’s tag and define your string there: