I want to pass a variable to a UIButton action, for example
NSString *string=@\"one\";
[downbutton addTarget:self action:@selector(action1:string)
forCo
You can use the strings of the UIControlStates that you dot'n use:
NSString *string=@"one";
[downbutton setTitle:string forState:UIControlStateApplication];
[downbutton addTarget:self action:@selector(action1:) forControlEvents:UIControlEventTouchUpInside];
and the action function:
-(void)action1:(UIButton*)sender{
NSLog(@"My string: %@",[sender titleForState:UIControlStateApplication]);
}