I have a table view in which each row is having a button. Am storing the data as the button's title.
What I need : I want to pass the selected button's title to the destination view controller.
Code :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSDictionary *dict = _json[indexPath.row]
[cell.bRedeem setTitle:dict[@"n_id"] forState:UIControlStateNormal];
}
- (IBAction)redeemClicked:(UIButton *)sender {
UIButton *button = (UIButton *)sender;
_nID = button.currentTitle;
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"showOffers"]) {
offerList *details = (offerList *)segue.destinationViewController;
details.nearID = _nID;
}
}