0

I add Tag for the each buttons in cell(button is single), when is built TableView as:

[cell.hiddenButtonWithIdCell setTag:(int) self.responseObject[@"results"][indexPath.row][@"id"]]; // Value is 4

Where hiddenButtonWithIdCell is button name (Outlet property):

@property (weak, nonatomic) IBOutlet UIButton *hiddenButtonWithIdCell;

Important: outlet in the file cell.h

At file where I loop table I have (so event action here):

Important: (Both the methods in the same file)

- (IBAction)openDetailsOfDish:(id)sender {
    NSLog(@"Click: %@", [sender tag]); // Here I get correct Tag and equal 20
    [self performSegueWithIdentifier:@"Full" sender:sender];
}

But at:

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(UIButton*) sender {
    NSLog(@"%@", sender.tag); // Here is wrong tag
}
Abamazi
  • 39
  • 5
  • Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/101014/discussion-on-question-by-abamazi-how-to-get-tag-of-button-by-clicking-from-cell). – George Stocker Jan 18 '16 at 21:20

1 Answers1

0

sender.tag is NSInterger so you should log this like that:

NSLog(@"MY SENDER TAG %lu", sender.tag);

Check here for more info about using button's tag with segue:

How to pass prepareForSegue: an object

Community
  • 1
  • 1
Nex
  • 71
  • 2