The tag value is an Integer:
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:addressField forState:UIControlStateNormal];
[bu
as far as i know tags are always type int.
youll need to convert it manually like:
NSString *temp : [[NSString alloc]init];
if(sender.tag == x){
temp = @"some string";
)
and make cases for the different tags.
please correct me if im wrong here :)
You can do that as bellow with the help of feature objc_runtime
#import <objc/runtime.h>
static char kButtonAssociatedKey;
NSString *aStrKey = [NSString stringWithFormat:@"Any Key"];
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:addressField forState:UIControlStateNormal];
[button addTarget:self action:@selector(pickTheQuiz:) forControlEvents:UIControlEventTouchUpInside];
button.tag=1;
objc_setAssociatedObject(button,
&kButtonAssociatedKey,
aStrKey,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-(void)pickTheQuiz:(id)sender
{
NSString *aStrKey = objc_getAssociatedObject(sender, &kButtonAssociatedKey);
objc_removeAssociatedObjects(sender);
NSLog(@"%@", aStrKey);
}