Reputation: 79
.... Call to webservice
NSArray *someValues = [results valueForKey:@"someKey"];
[button setTitle:[NSString stringWithFormat:@"%@", [someValues objectAtIndex:i]] forState:UIControlStateNormal];
} // end
-(void)btnPressed:(id)sender
{
UIButton *button = sender;
button.currentTitle; // Title comes back just fine
}
I want to be able to add more parameters so I can get them back on the click method. So example
button.someParam = @"My name"
...
// once clicked
UIButton *button = sender;
button.someParam // gets back "My Name"
Currently I can set a custom title and get it back just fine. I would like to add more values to pass along with my button. Is this possible? These values are coming back dynamically. I know I can set the tag # but that won't help me get custom values back from what I've tried.
Upvotes: 1
Views: 86
Reputation: 79
I resolved this with sort of a hack fix for now. I'll keep on looking for the best way to implement this. But for now I just used the accessibilityValue as a parameter and then I was able to retrieve later.
button.accessibilityValue = [NSString stringWithFormat:@"%@", [someArray objectAtIndex:i]];
Upvotes: 0
Reputation: 23634
You want to add properties to a UIButton
.
One way to do this is to make a UIButton
subclass and add the properties there. Then use that subclass instead of a regular UIButton
.
Upvotes: 1